-
Notifications
You must be signed in to change notification settings - Fork 425
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(sanity): allow Actions API enablement based on Studio version semver constraint #6993
feat(sanity): allow Actions API enablement based on Studio version semver constraint #6993
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
|
be002ba
to
3c5cc31
Compare
No changes to documentation |
Component Testing Report Updated Jul 8, 2024 10:21 PM (UTC)
|
392ec17
to
3c5efbe
Compare
3c5efbe
to
e6fb0df
Compare
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.
Nice, glad the feature toggle endpoint is getting enriched :) And thanks for the improved tests!
…test cases This commit also removes the `__internal_serverDocumentActions` override from the E2E Studio. Actions API enablement can now be controlled dynamically using the `mockActionsFeatureToggle` helper.
0e94b1a
to
af9ed2e
Compare
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.
assume it's the same before the rebase!
@cngonzalez It is. Thank you! |
Description
This change allows us to dynamically enable the Actions API based on the Studio version (post this release) from the Actions API. The API response now includes a
compatibleStudioVersions
property specifying a semver range that indicates the compatible Studio versions. If the feature toggle is enabled, Studio will first confirm it satisfies the semver constraint before enabling the gated functionality.The feature toggle will never be acknowledged by existing Studio releases.
To briefly outline how this works in Studio:
actions
property as falsey, meaning they will never enable Actions API usage based on this feature toggle.enabled
istrue
and the Studio version satisfies the semver constraint specified incompatibleStudioVersions
.What to review
The resolution of the Actions API feature toggle (
packages/sanity/src/core/store/_legacy/document/document-pair/utils/fetchFeatureToggle.ts
).Testing
packages/sanity/src/core/store/_legacy/document/document-pair/utils/fetchFeatureToggle.test.ts
.test/e2e/tests/document-actions/fetchFeatureToggle.spec.ts
.To manually test, find the
GET
request fordata/actions
in your dev tools and override the response body like so:After reloading the page, you should find the Actions API is being used.
Note: You must ensure the
__internal_serverDocumentActions.enabled
override is not present in your Studio config. It short-circuits the feature toggle.