-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 performance of Angular rerender #6094
Conversation
Codecov Report
@@ Coverage Diff @@
## next #6094 +/- ##
==========================================
- Coverage 37.64% 37.08% -0.57%
==========================================
Files 642 648 +6
Lines 9387 9538 +151
Branches 1363 1384 +21
==========================================
+ Hits 3534 3537 +3
- Misses 5293 5421 +128
- Partials 560 580 +20
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonrimmer Thanks for this---looks like an awesome solution to a thorny problem! I'm not familiar with Angular enough to do a review, hoping @igor-dv @kroeder @CodeByAlex can take a look.
My two suggestions:
- Use
addParameters({knobs: {disableDebounce: true}}
instead ofwithKnobs({ disableDebounce: true })
=> we're trying to migrate everything over to parameters across the board - I think the knobs debouncing by @CodeByAlex was mostly for angular. If this PR solves the problem for angular, can we also remove debouncing in the knobs addon?
@shilman No problem, I'll update it as you suggest. Centralised debouncing should be removable if each framework's app implements forced re-render in a way that's sympathetic to its method of receiving updates and updating the DOM. For React and React-esque frameworks that should already be the case, and this PR fixes the situation for Angular. What I'm not clear about is what the situation is like for other frameworks like Polymer, Vue, etc. It certainly seems like Vue was affected prior to the debounce being added: #6005 |
@jonrimmer I invited you to the GitHub organisation so you con contribute more easily 👍 |
Looks good to me, let's get a second opinion out of @kroeder before merging |
df6bf95
to
e651a3b
Compare
@ndelangen Thanks, I really appreciate it. |
@jonrimmer Good call on making sure Vue works properly, so we can potentially remove global debouncing separately. Super happy with this solution for Angular tho--great work! |
@shilman @jonrimmer LGTM. I like how the changes to allow for better updating and rendering are located within the Angular project rather than having to add an "addon-knobs/angular" option which was mentioned in the original issue. Nicely done:) |
since the 4.2 alpha introduced my changes to the storybook vue, debouncing the knobs should not be necessary at all for vue, since we properly change the props of the components in a reactive "vue way". |
Issue: #4098
What I did
disableDebounce
option to knobs so you can disable the 350ms debounce if you know the re-rendering of the framework you're using isn't broken.How to test
Run the Angular example and use the knobs. Observe that they update immediately and without lag.