feat(query): clearing data after unset listener
See original GitHub issueDo you want to request a feature or report a bug?
bug
What is the current behavior? If i want to change a document listener to another id, then previous data is still existing until new data is received.
What is the expected behavior? After removing the listener, the data connected to that listener should be removed.
Which versions of dependencies, and which browser are affected by this issue? Did this work in previous versions or setups? Newest
Steps to reproduce and if possible a minimal demo of the problem via codesandbox or similar.
[
{
collection: 'collections',
doc: props.collectionId, // data from my reducer. If this id is changed then previous data is still existing
storeAs: 'collection'
}
]
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:10 (3 by maintainers)
Top Results From Across the Web
javascript - Event listener for when element becomes visible?
Is there a way i can put an event listener on my toolbar to listen for when it becomes visible so it can...
Read more >MySQL 8.0 Reference Manual :: 5.1.8 Server System Variables
The MySQL server maintains many system variables that configure its operation. Each system variable has a default value. System variables can be set...
Read more >sanity-io/client - GitHub
Deleting an element from an array. Each entry in the unset array can be either an attribute or a JSON path. In this...
Read more >Go Fiber by Examples: Delving into built-in functions
After executing, a new Fiber instance will be created in the app variable with ... handler) // Create a new route with DELETE...
Read more >Connecting Firebase to a Contact Form - YouTube
In this video we will take the responsive contact form we built in the last video and hook it up to a firebase...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I agree with @apietrzak - of course we can store the data with a custom-made key for each document, but that will not only make the app a bit code more complex, it also leads to memory leaks, when the user is browsing around in 100s or 1000s of pages in the app, all these are kept in the store, because they were once loaded.
I don’t see any solutions that are more elegant than the
removeOnUnset: true
option suggested.@prescottprue I understand it, but still, i don’t need that data in the store if a listener was removed. For example: A user iterates over 100 collections, then it’s taking 100 entries in the store.
Additionaly, when the user backs to the first collection then in the store is still old data and will be refreshed soon, which means the user will see old view of my appliaction instead of loading screen. In my case, there will be better to remove that data and load it one more time if needed. For example by adding argument to listener config: