fix: detect $extensions changes in sync diff so modifier edits are no…#3900
fix: detect $extensions changes in sync diff so modifier edits are no…#3900akshay-gupta7 wants to merge 4 commits into
Conversation
… longer silently dropped
🦋 Changeset detectedLatest commit: 1d18b2e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
|
|
Commit SHA:b0f985a039faf2c7c3ed7b401cbc973fff795776 Test coverage results 🧪
|
|
🛡️ Hyma Compliance Check ✅ No compliance findings — 0 findings across reviewed files. Categories checked: ROPA · Subprocessor · Access Control · AI Provider Routing · Secrets/Credentials · Policy Gap Assessment: Adds
|
|
🛡️ Hyma Compliance Check ✅ No compliance-relevant changes detected 2 file(s) scanned · 0 findings Changes extend
|
There was a problem hiding this comment.
Pull request overview
Updates the token sync-diff logic so changes in a token’s $extensions (notably modifier edits) are detected and included in the computed changed state, preventing modifier-only changes from being skipped during sync.
Changes:
- Treat
$extensionsdifferences as token updates infindDifferentState. - Expand Jest coverage for updated values, removals, and
$extensionsmodifier add/remove/change scenarios.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/tokens-studio-for-figma/src/utils/findDifferentState.ts | Extends update detection to include $extensions diffs during token comparisons. |
| packages/tokens-studio-for-figma/src/utils/findDifferentState.test.ts | Adds test cases for value updates, removals, and modifier-only $extensions changes. |
Comments suppressed due to low confidence (1)
packages/tokens-studio-for-figma/src/utils/findDifferentState.ts:30
- When an update is triggered solely by a $extensions change (with the token value unchanged), this code still sets
oldValue, which makes the UI treat it as a value diff and can display an “old” and “new” value that are actually identical. Consider only settingoldValuewhen the value itself changed, while still marking the token asUPDATEwhen $extensions changed.
if (!isEqual(oldValue.value, token.value) || !isEqual(oldValue.$extensions, token.$extensions)) {
const updatedToken: ImportToken = { ...token };
updatedToken.oldValue = oldValue.value;
updatedToken.importType = 'UPDATE';
updatedTokens.push(updatedToken);
|
🛡️ Hyma Compliance Check ✅ No compliance-relevant changes detected Files changed in this PR were reviewed against the compliance taxonomy (ROPA, Subprocessor, Access Control, AI Provider Routing, Secrets/Credentials, Policy Gap). No findings were identified.
|
|
🛡️ Hyma Compliance Check ✅ No compliance-relevant changes detected 1 file(s) scanned · 0 findings
|
|
🛡️ Hyma Compliance Check ✅ No compliance-relevant changes detected Files scanned · 0 findings No new external calls, personal data processing changes, or authentication/authorization modifications detected. No compliance action required.
|
|
🛡️ Hyma Compliance Check ✅ No compliance-relevant changes detected 2 file(s) scanned · 0 findings
|
1 similar comment
|
🛡️ Hyma Compliance Check ✅ No compliance-relevant changes detected 2 file(s) scanned · 0 findings
|
… longer silently dropped
Why does this PR exist?
Closes #0000
Editing an opacity modifier on a token updated the value correctly in the plugin but was never detected by the sync diff, so the change tab showed nothing and the commit could never be made.
What does this pull request do?
findDifferentStatenow compares$extensionsalongsidevalueanddescriptionwhen detecting token updatesoldValueis only populated when.valueitself changed — not on$extensions-only diffs — to avoid misleading value diffs in the UIoldValueis absent on extension-only updatesTesting this change
0.5→0.35) and saveAdditional Notes (if any)
The same fix covers all
$extensionschanges (lighten, darken, mix modifiers), not just opacity — opacity was the only one customers reported because it is the most commonly used.