-
Notifications
You must be signed in to change notification settings - Fork 426
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: fetch feature toggle to enable serverside document actions #6418
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
No changes to documentation |
Component Testing Report Updated May 15, 2024 1:35 PM (UTC)
|
cngonzalez
force-pushed
the
sdx-1277/scaffold-feature-flag
branch
from
April 19, 2024 16:45
32dc7b1
to
a4ecd32
Compare
cngonzalez
changed the title
feat: scaffold feature flag in studio
feat: scaffold feature toggle fetch in studio
Apr 19, 2024
cngonzalez
force-pushed
the
sdx-1277/scaffold-feature-flag
branch
from
May 8, 2024 13:33
e903a86
to
4662b9b
Compare
cngonzalez
force-pushed
the
sdx-1277/scaffold-feature-flag
branch
from
May 8, 2024 21:53
4662b9b
to
cf1c9d4
Compare
bjoerge
force-pushed
the
sdx-1277/scaffold-feature-flag
branch
from
May 15, 2024 12:18
8c30fe1
to
ef3c189
Compare
juice49
previously approved these changes
May 15, 2024
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.
This is great!
bjoerge
approved these changes
May 15, 2024
juice49
approved these changes
May 15, 2024
ricokahler
pushed a commit
that referenced
this pull request
May 15, 2024
* feature: scaffold feature flag function * revert back operations for now until caching issue is fixed * refactor: try memoizing featureToggle * refactor: use shareReplay * feat: add feature toggle requests to operations events etc. * refactor: rename featureToggleRequest * fix: do not pass canUseServerActions to snapshot pair * refactor(document-store): pass in server actions config as observable (#6582) * feat: use real endpoint in fetchFeatureToggle * test: update checkoutPair and add featureToggle e2e test * chore: remove comment now that proper endpoint is in place * fix(document-store): timeout feature flag req after 2s and treat as 'false' * fix(sanity): make config flag override server document actions (#6634) --------- Co-authored-by: Bjørge Næss <bjoerge@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
As we move toward transitioning to server-side document actions, we'd like to have some ability to have a remote way to configure whether or not our end users' document actions should be utilizing the Actions API endpoint, in case there's some risk or problem in content creation.
This PR introduces a remote check used in those places that code paths might diverge based on whether or not to use server actions. This way, we can shut off server actions and revert to old and tested functionality if needed.
This is done through the following:
sanity.config.ts
flag. If it is set to false, then the old mutations endpoint should be used, no matter what.document-store
. This HTTP request lasts, at most, two minutes (thanks very much to @bjoerge for refining this).serverActionsEnabled
parameter is observable, it is no longer included in memoization.What to review
Any gotchas. As of this writing, the
/data/actions
GET request is returning afalse
-- so even if the config flag is set, users should continue to see the mutations endpoint being used.Testing
There were already tests in place to ensure that
checkoutPair
sent the correct requests based on theserverActionsEnabled
parameter. These have been updated to respect that it is now an observable.An additional end-to-end test was added to spy on requests made on document load and edit -- to ensure that the actions we send follow what we receive from the feature toggle endpoint.