-
Notifications
You must be signed in to change notification settings - Fork 1
feat: support using the same instance for different datasets #632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
1c97ac7 to
f6786b1
Compare
2cbcac0 to
8b5e9b8
Compare
f6786b1 to
9a3e862
Compare
9a3e862 to
7029e15
Compare
8b5e9b8 to
5c97111
Compare
5c97111 to
39345d2
Compare
7029e15 to
0698478
Compare
0698478 to
0f7802b
Compare
39345d2 to
d1b957f
Compare
0f7802b to
6992e87
Compare
6992e87 to
e99e804
Compare
This introduces the concept of a "key" for a store. The main goal here is to enable the support for us using a single SanityInstance across all the stores, but still have separate stores per projectId/dataset. This is accomplished by saying that each store is determined by a "key" which can be dynamically built from the options. We first invoke the key logic and then dispatches to the right store. For now have projectId/dataset keys, but in the future we expect this to be per-resource. This also means that it's possible to use a single SanityInstance for working with multiple projectId/dataset. If you pass in an explicit projectId/dataset then it will no longer care about the configuration on the SanityInstance.
e99e804 to
9b9fc3a
Compare
cngonzalez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate the lack of breaking changes to any exported utils! Also did some manual testing in those places where there could have been some divergence (how the client is retrieved in the perspective store, for example), and saw no issues.

Description
This introduces the concept of a "key" for a store. The main goal here is to enable the support for us using a single SanityInstance across all the stores, but still have separate stores per projectId/dataset. This is accomplished by saying that each store is determined by a "key" which can be dynamically built from the options. We first invoke the key logic and then dispatches to the right store. For now have projectId/dataset keys, but in the future we expect this to be per-resource.
This also means that it's possible to use a single SanityInstance for working with multiple projectId/dataset. If you pass in an explicit projectId/dataset then it will no longer care about the configuration on the SanityInstance.
What to review
Testing
Fun gif