Repository navigation
fix(internationalized-array): collapse object values inside language rows - #2262
pedrobonamin wants to merge 7 commits into
Conversation
🦋 Changeset detectedLatest commit: 3a2d630 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
✅ E2E Tests🟢 46 passed • view full report • view run Studio: https://plugins-e2e-test-studio-58mv8pyk2.sanity.dev Datasets: |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d1f1bdd. Configure here.
3d8d98d to
1d45bbf
Compare
Studio computed collapsed from the shared value type, so the option on an internationalized array field never reached an object such as a file. Apply it on the value field member and keep a later editor toggle. Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
Knip flagged collapseStateFromOptions; it is only used in the same module, so keep it private. Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
…uage Center the legend toggle on the language label so the chevron lines up with it. Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
…ests Workspace imports of internationalized-array load its .css.ts source. Register the vanilla-extract Vitest plugin so those tests can transform it. Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
…ne style Replace the vanilla-extract stylesheet with an inline style on the language label, applied only when the row is collapsible. Drop the bundle.css export and the vanilla-extract build and Vitest setup this needed in both plugins. Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
The accept passthrough already shipped with #2063, and Version Packages consumed that changeset. This file now describes only the collapsed object behavior. Co-authored-by: Pedro Bonamin <pedrobonamin@users.noreply.github.com>
1d45bbf to
3a2d630
Compare

Follow-up to #2063. Base branch is
cursor/sieve-1956-a4b6.Summary
collapsedon an internationalized array field is copied onto the value field's options by #2063, and Studio still opens the object expanded. This PR makescollapsedstart an object value collapsed inside the language row, and lines the chevron up with the language label.The language row stays open. Only the object (a file, an image, or a custom object) collapses. Opening or closing it after that is remembered.
How it works
Studio decides collapse while it builds form state, and stores
collapsedandcollapsibleon the field member. Copying the option ontoschemaType.optionslater does not change that decision. Primitive values are not collapsible.For an object value, the row sets those member flags from the merged options, using the same rules Studio uses:
collapsed: truealso makes the object collapsible, so it can be opened again.collapsible: false(orcollapsable: false) keeps it open.collapsedthat differs from the value type's own default is treated as the editor's toggle and kept.The collapse chevron sits in a 9px box inside Studio's legend toggle, a flex row with no cross-axis alignment, so it sits below the language label. The language row sets
align-items: centeron that toggle.Try it in the test studio
https://plugins-studio-git-cursor-sieve-1956-collapsed.sanity.dev/home/structure/issue1956Repro;a25460fe-6b14-4b60-a4da-6bff8418f173
The Home workspace Issue #1956 reproduction document now starts the English file object collapsed. Open it and the file picker only offers
.vttand.srtfiles. Close it and the upload control hides again.Tests
collapsible: falsewins overcollapsed: true.InternationalizedInputapplies those flags on the member and still passesacceptthrough.@sanity/document-internationalizationimports this plugin from source. Its Vitest config compiles the new vanilla-extract file, which otherwise fails with "Styles were unable to be assigned to a file."Changeset
The parent PR's changeset gains the
collapsedbehavior. If #2063 merges first and that file is consumed, this line needs to be re-added before release.Note
Low Risk
Editor-only form behavior in one plugin with unit tests; no auth, data, or API surface changes beyond documented field options.
Overview
collapsedon internationalized array fields now affects object values (files, images, custom objects), not only copiedschemaType.options.InternationalizedInputappliescollapseFlagsForValueFieldso each language row’svaluemember gets Studio-alignedcollapsed/collapsibleflags, preserves an editor expand/collapse toggle, and ignores primitives.A small vanilla-extract stylesheet on the language row aligns the object collapse chevron with the language label. The plugin gains tsdown vanilla-extract output (
./bundle.css), and Vitest insanity-plugin-internationalized-arrayand@sanity/document-internationalizationregistersvanillaExtractPlugin()so workspace source imports compile.css.ts.README, changeset, test-studio Issue #1956 repro, and agent styling docs are updated to describe supported
collapsedbehavior and dependent-package Vitest setup.Reviewed by Cursor Bugbot for commit d1f1bdd. Configure here.
Follow-up to #2063. Base branch is
cursor/sieve-1956-a4b6.Summary
collapsedon an internationalized array field is copied onto the value field's options by #2063, and Studio still opens the object expanded. This PR makescollapsedstart an object value collapsed inside the language row, and lines the chevron up with the language label.The language row stays open. Only the object (a file, an image, or a custom object) collapses. Opening or closing it after that is remembered.
How it works
Studio decides collapse while it builds form state, and stores
collapsedandcollapsibleon the field member. Copying the option ontoschemaType.optionslater does not change that decision. Primitive values are not collapsible.For an object value, the row sets those member flags from the merged options, using the same rules Studio uses:
collapsed: truealso makes the object collapsible, so it can be opened again.collapsible: false(orcollapsable: false) keeps it open.collapsedthat differs from the value type's own default is treated as the editor's toggle and kept.Chevron alignment
The language label is a
<Label>the plugin passes as the field title, and Studio wraps it in its own title<Text>. Both components trim their line height to the cap height, so the 7px label sits about 6px above the chevron. When the row is collapsible, the label gets an inlinedisplay: inline-block; vertical-align: middle, which centers it on the line the chevron sits on. Rows without a chevron keep the label as it was.No stylesheet, build or Vitest changes are needed.
Try it in the test studio
https://plugins-studio-git-cursor-sieve-1956-collapsed.sanity.dev/home/structure/issue1956Repro;a25460fe-6b14-4b60-a4da-6bff8418f173
The Home workspace Issue #1956 reproduction document now starts the English file object collapsed. Open it and the file picker only offers
.vttand.srtfiles. Close it and the upload control hides again.Collapsed row: chevron aligned with the EN label
Expanded row: chevron aligned with the EN label
Tests
collapsible: falsewins overcollapsed: true.InternationalizedInputapplies those flags on the member and still passesacceptthrough.Changeset
The parent PR's changeset gains the
collapsedbehavior. If #2063 merges first and that file is consumed, this line needs to be re-added before release.To show artifacts inline, enable in settings.