-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Implementing a cache for the gettersProxy object creation #1546
Conversation
…erformance wth large number of modules/getters
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.
Thank you for making this PR!
Please remove package-lock.json
and revert the change to dist/vuex.common.js
src/store.js
Outdated
Object.defineProperty(gettersProxy, localType, { | ||
get: () => store.getters[type], | ||
enumerable: true | ||
if (cacheStore !== store) { |
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.
This way of clearing cache is not comprehensive. Getters may be changed via registerModule
, unregisterModule
or hotUpdate
.
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.
Thank you so much for your reply! Could you give me a hint here?
I see that all those functions end up calling resetStoreVM
, do you think that is the proper place to clear the cache?
That way I could also get rid of that cacheStore
variable
…ll ssr performance wth large number of modules/getters" This reverts commit 2df536b.
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.
Resetting it in resetStoreVM
looks very good idea 👍
I've commented for some small tweaks.
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.
Thank you!
Hey @frankcs, thank you for your time and effort spent on this PR, contributions like yours help make Vue better for everyone. Cheers! 💚 |
@ktsn can you check my issue too? vuejs/devtools-v6#1058 |
|
…s#1546) * Implementing a cache for the gettersProxy object creation. Kill ssr performance wth large number of modules/getters * Revert "Implementing a cache for the gettersProxy object creation. Kill ssr performance wth large number of modules/getters" This reverts commit 2df536b. * Resetting the make local getters cache when the store gets updated * Changing cache to makeLocalGetters to instance internal state
Fixes #1539