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
feat(core): fetch structure tool settings from backend #5901
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
No changes to documentation |
Component Testing Report Updated Mar 7, 2024 5:05 PM (UTC)
|
import {type KeyValueStore, type KeyValueStoreValue} from './types' | ||
|
||
/** @internal */ | ||
export function createKeyValueStore(): KeyValueStore { | ||
const storageBackend = resolveBackend() |
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.
@jtpetty has recommended we fall back to localStorage if the API is not available here. I've not included it in this PR since I didn't find a trivial way to deal with the asynchronous state of pinging the backend from within the resourceCache context. Hopefully it's possible.
packages/sanity/src/core/store/key-value/backends/localStorage.ts
Outdated
Show resolved
Hide resolved
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.
LGTM one nit pick comment and question regarding failing test
'{"by":[{"field":"name","direction":"asc"}],"extendedProjection":"name"}', | ||
) | ||
const nameResult = await sanityClient.request({ | ||
uri: `/users/me/keyvalue/${SORT_KEY}`, |
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.
🤔 probably need to set version to vX
to fix the failing tests?
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.
oh maybe thinking about it more, is it because it's hitting prod?
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.
Do the e2e tests in CI take place in staging?
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.
no they are against production
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.
Thought so! Can certainly change the API version if we want to, but that'll be (hopefully) be a short lived change (and won't currently fix tests 😅 )
9c1d928
into
feat/fetch-settings-from-backend
* feat(core): fetch structure tool settings from backend (#5901) * feat(core): store recent search history in backend (#5940) * feat(core): fetch inspect mode from backend (#5938) * chore: update studio version for production-ready cellar (#5993) * fix: prevent key value store from firing setKey for each open subscription (#5997) * fix: update tests to match api (#6000) * fix: update tests to match api * fix: comment out flaky tests for now * chore: remove unused resolve logic
Description
Scaffolds a Dataloader that hits an API endpoint for user settings -- in this case, specifically those settings relevant to structure tools.
This is meant to be just a scaffold. In the following day, please expect:
What to review
The Dataloader backend specifically -- does it work as we expect? Any gotchas? Are errors being handled correctly?
Testing
End-to-end tests are already in place. They've been refactored since they referred to localStorage changes.