You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently @Tanstack/Query use a centralised store for all queries with an approach similar to the one described (in a lot more simple version) in this playground
We use the queryClient to manipulate this centralised store and add some typings artifacts to stay type safe as much as we can when we do this.
But maybe we could change this approach to a more modular more like this one.
The idea behind this modular approach is that each query have it's own store and we manipulate it threw the query object itself.
It would make type safety a lot more easy as we no more have this key based store where you can accidentally use an already defined key, especially in big projects. We could also use this in a more modular way, I think of the use case of an enterprise authentication lib that could use tanstack/query without any risk of conflict with applictaions using this authentication lib that could use the same keys or a different version of tanstack/query-core.
But this would be a huge change that would justify a new major version and maybe some backward compatibility for few versions...
I would be interested on having feedback on this idea and if we want to go this way I'll also be available to work on this change.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Currently @Tanstack/Query use a centralised store for all queries with an approach similar to the one described (in a lot more simple version) in this playground
We use the queryClient to manipulate this centralised store and add some typings artifacts to stay type safe as much as we can when we do this.
But maybe we could change this approach to a more modular more like this one.
The idea behind this modular approach is that each query have it's own store and we manipulate it threw the query object itself.
It would make type safety a lot more easy as we no more have this key based store where you can accidentally use an already defined key, especially in big projects. We could also use this in a more modular way, I think of the use case of an enterprise authentication lib that could use tanstack/query without any risk of conflict with applictaions using this authentication lib that could use the same keys or a different version of tanstack/query-core.
But this would be a huge change that would justify a new major version and maybe some backward compatibility for few versions...
I would be interested on having feedback on this idea and if we want to go this way I'll also be available to work on this change.
Beta Was this translation helpful? Give feedback.
All reactions