Skip to content

Conversation

@judofyr
Copy link
Contributor

@judofyr judofyr commented Sep 22, 2025

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

@vercel
Copy link

vercel bot commented Sep 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sdk-docs Ready Ready Preview Comment Sep 25, 2025 10:37am
sdk-kitchensink-react Ready Ready Preview Comment Sep 25, 2025 10:37am

@judofyr judofyr force-pushed the holm/require-project-id branch from 2cbcac0 to 8b5e9b8 Compare September 23, 2025 14:03
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant