Select, structuralSharing and 'global' stability
If I run a non-select query twice, the returned data will be identical, globally.
When I use a query with a select, that reshapes the data (instantiates new variables) this is no longer true.
I know that each observer has its own
#selectResult
and this is why they are no longer identical, but would it be a viable to extend the functionality of memoization (hacky implementation + cleanup on unsub):
to memo the selectResult
globally based on options.select
/#selectFn
(and probably structuralSharing
too)?
I understand that this would require select
to be as stable as possible - either static or memoized - or adding a new selectKey
prop, but maybe 🙃 ?3 Replies
manual-pink•17mo ago
Could you please explain what we would gain from this?
extended-salmon•17mo ago
you can use some global memoization lib like
reselect
to have the selector result cached globally. We're not gonna do this in query.subsequent-cyanOP•17mo ago
Alright, thanks.