Closed Shajansheriff closed 2 years ago
@Shajansheriff thanks for starting the discussion!
I think supporting nested keys is a natural evolution of the package, it will be a fun experiment with Typescript to make that happen.
I really liked the idea of merging the keys, and inspired by that I've got a similar API:
It uses the default
key a user provided to create the query scope to populate the fields on a single object.
How does that sound to you?
I feel like providing both APIs (creating smaller scopes and merging into a single one, and creating a single huge factory) will be useful for cases that depend on how people like to structure their code.
I'm thinking createQueryKeys
+ createMergedQueryKeysFactory
(name TBD) will serve people that like smaller files and slices of objects that they can then merge into a big one, and the next step would be to create a createQueryKeysFactory
that creates a single huge object
This is just to initiate a discussion around supporting nested keys. @lukemorales have you seen trpc router examples https://trpc.io/docs/v9/merging-routers? It would be great if we could think about how to support nested and merging keys. Most of the time, people like to organise in a central location.
`