Skip to content
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

fix variable setting for various cases #3219

Merged
merged 2 commits into from
Dec 9, 2024

Conversation

six7
Copy link
Collaborator

@six7 six7 commented Dec 4, 2024

Why does this PR exist?

Closes #3208

The prod version currently just checks for equality of old value vs new value, but forgets that alias references could exist which would always mean they're not equal - thus we're not updating the reference when the user goes from reference -> hard value. It worked before if we went from reference -> another reference (because another function is responsible for that)

What does this pull request do?

This PR modifies the early return to not return if we have an alias reference, and instead go and update.

Testing this change

Create variables of all types and export to Figma that are a hard value and the other a reference to another variable
Then update the variable that references to now be a hard value again.

Copy link

changeset-bot bot commented Dec 4, 2024

🦋 Changeset detected

Latest commit: 1f7988b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@tokens-studio/figma-plugin Patch

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

Copy link
Contributor

github-actions bot commented Dec 4, 2024

⤵️ 📦 ✨ The artifact was successfully created! Want to test it? Download it here 👀 🎁

Copy link
Contributor

github-actions bot commented Dec 4, 2024

Commit SHA:949b608b303c7eceb28200e1d928c58bade10eec

Test coverage results 🧪

Code coverage diff between base branch:main and head branch: six7/fix-variable-reference-set-value 
Status File % Stmts % Branch % Funcs % Lines
🟢 total 67.05 (0.05) 57.94 (0.11) 63.89 (0.01) 67.39 (0.03)
🟢 packages/tokens-studio-for-figma/src/plugin/setBooleanValuesOnVariable.ts 87.5 (17.5) 100 (33.34) 100 (0) 85.71 (7.94)
🔴 packages/tokens-studio-for-figma/src/plugin/setColorValuesOnVariable.ts 100 (0) 89.65 (-10.35) 100 (0) 100 (0)
🟢 packages/tokens-studio-for-figma/src/plugin/setNumberValuesOnVariable.ts 100 (33.34) 100 (33.34) 100 (0) 100 (25)
🟢 packages/tokens-studio-for-figma/src/plugin/setStringValuesOnVariable.ts 85.71 (14.29) 100 (25) 100 (0) 83.33 (0)
✨ 🆕 packages/tokens-studio-for-figma/src/utils/isAliasReference.ts 100 33.33 100 100

Copy link
Contributor

github-actions bot commented Dec 4, 2024

Commit SHA:949b608b303c7eceb28200e1d928c58bade10eec
Current PR reduces the test coverage percentage by 1 for some tests

@rbosker
Copy link
Collaborator

rbosker commented Dec 4, 2024

Tested with exporting as sets and exporting as themes. Both work as expected and you can change a reference to raw value and vice versa again.

Copy link
Contributor

@akshay-gupta7 akshay-gupta7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working as expected!✨

@six7 six7 merged commit 01ccff2 into main Dec 9, 2024
9 of 10 checks passed
@six7 six7 deleted the six7/fix-variable-reference-set-value branch December 9, 2024 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export Variables: once Variables are exported, you can't update a reference to raw value and vice versa
3 participants