useStore: have a separate subscription for object shape #195
wmertens
started this conversation in
Proposals For Qwik
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What is it about?
subscribing to mapping a store
What's the motivation for this proposal?
Problems you are trying to solve:
Right now when you do
Object.keys(store)
, you subscribe to the store object and all mutations of it attributes.Instead, you should only be subscribed to shape changes.
Proposed Solution / Feature
What do you propose?
in the store proxy, calling the ownKeys should subscribe you to a separate signal that only gets called when the object keys change
This becomes an important distinction when mapping a store to DOM, and mutating the store elements. Currently, that rerenders the mapping, and only the changed elements should be rerendering.
Code examples
https://qwik.dev/playground/#f=7VbLCsIwEPyV3JJCCb7wILYf4EEPHsWDT9L6qBCKlJB%2Fd5KtNRaRXgVPIQtZdjPDzASkGY96n0gTN5b7lT60J8lkEjyfwmVSIQwDss32oTNzeqNhUDhQgaGeK3Z3MrnZ711o8EmDRwEBXRahXHE6VMDULLY55FO6m9CRzKGRgjMeWcot4Gc3hr9N5pAOBzuAf5WXcW%2BQNMBOba7wFj9eHWjwAU1M8esbprIJW%2FVjNojZcI2faO1CuFCyegUKQ3NpuYVaJowrRwRuU%2FgwPA9WUsBJUWoyWbc2x6LVBIWuLVQmb6VWop4lsuml9NapslaLGtbEaPukoZktF3NJSTA7VgDKok4I%2FSXkVyXkAQ
Links / References
No response
Beta Was this translation helpful? Give feedback.
All reactions