Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(view rendering): cancel overlapping resource requests #5917

Merged
merged 2 commits into from
Oct 20, 2021

Conversation

fschade
Copy link
Collaborator

@fschade fschade commented Oct 17, 2021

Description

While testing the files app with heavy load we've found some cases where it could happen that the ui breaks or displays wrong list of files, this only happened when navigation fast between the different views.

To dig a bit deeper we've used the mounted and created hooks to load current views resources for files app, which can lead to overlapping rendering when view A still prepares the resource data and the user quickly switches to view B. If then B is rendered before A is finished vue renders the view A into B.

This is an overall problem and is present in many projects, where state, data and timing overlaps. This potentially is a memory leak also, in cases where this is used and the instance isn't around anymore.

This PR fixes those cases for the files app by superseding the usual vue behavior and use iterable generators from vue-concurrency and cancel the preparation step (request loading, state loading, view rendering) when not needed anymore.

Related Issue

Motivation and Context

get a fast and concurrency safe ui

How Has This Been Tested?

  • test suite
  • hammering the ui locally

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Checklist:

  • Code changes
  • Unit tests added

Open tasks:

  • none expect decision and testing ;)

@fschade fschade added the Status:Needs-Review Needs review from a maintainer label Oct 17, 2021
@fschade fschade self-assigned this Oct 17, 2021
Copy link
Member

@kulmann kulmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍😍😍

changelog/unreleased/bugfix-overlapping-view-requests Outdated Show resolved Hide resolved
changelog/unreleased/bugfix-overlapping-view-requests Outdated Show resolved Hide resolved
packages/web-app-files/src/views/Favorites.vue Outdated Show resolved Hide resolved
packages/web-app-files/src/views/Favorites.vue Outdated Show resolved Hide resolved
@kulmann
Copy link
Member

kulmann commented Oct 17, 2021

Linter is not happy. ;-) Tested it locally and wasn't able to break it. 🚀

Copy link
Member

@kulmann kulmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you forgot the PublicFiles and LocationPicker views.

introduce iterable generators using vue-concurrency to cancel resource
request that no longer needed.
Fixes wrong view rendering for long
running requests
@sonarcloud
Copy link

sonarcloud bot commented Oct 20, 2021

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

4.8% 4.8% Coverage
23.5% 23.5% Duplication

@fschade fschade requested a review from kulmann October 20, 2021 11:52
Copy link
Member

@kulmann kulmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@kulmann kulmann merged commit b741f6b into master Oct 20, 2021
@delete-merged-branch delete-merged-branch bot deleted the generator-concurrency branch October 20, 2021 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status:Needs-Review Needs review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Responses are rendered in different places
2 participants