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 zombie variables #3137

Merged
merged 6 commits into from
Sep 18, 2024
Merged

fix zombie variables #3137

merged 6 commits into from
Sep 18, 2024

Conversation

six7
Copy link
Collaborator

@six7 six7 commented Sep 14, 2024

Why does this PR exist?

Closes #3140

What does this pull request do?

This adds a check before we gather variables to use for references or for application, to see if the variable collection of those variables still exists.

Testing this change

Open a file affected by this bug (hard to replicate). File in DM with @rbosker has this: https://hyma-team.slack.com/archives/D03HL8WE738/p1726231101338089 - https://www.figma.com/design/foDPZl0c28gzctr6ztvNfy/Components-Roberto-(Copy)?t=I2ASNxMojuiwTyTv-0

Before

CleanShot 2024-09-14 at 18 20 44@2x

After

CleanShot 2024-09-14 at 18 25 46@2x

Copy link

changeset-bot bot commented Sep 14, 2024

🦋 Changeset detected

Latest commit: c0b1c1a

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 Sep 14, 2024

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

Copy link
Contributor

github-actions bot commented Sep 14, 2024

Commit SHA:0e8184ede0ae7f7d0776a5e7c73c3cf0e83e820c

Test coverage results 🧪

Code coverage diff between base branch:main and head branch: fix/zombie-variables 
Status File % Stmts % Branch % Funcs % Lines
🟢 total 67.88 (0.03) 58.51 (0) 64.62 (0.05) 68.27 (0.02)
✨ 🆕 packages/tokens-studio-for-figma/src/plugin/getVariablesWithoutZombies.ts 100 50 100 100

@six7 six7 marked this pull request as ready for review September 14, 2024 16:26
Copy link
Contributor

@macintoshhelper macintoshhelper left a comment

Choose a reason for hiding this comment

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

LGTM.

Does any usage of figma.variables.getLocalVariables() need to be replaced with (await getVariablesWithoutZombies()) going forward? Maybe a custom ESLint rule or something could be useful for this to prevent the bug from being reintroduced in the future.

@six7
Copy link
Collaborator Author

six7 commented Sep 17, 2024

LGTM.

Does any usage of figma.variables.getLocalVariables() need to be replaced with (await getVariablesWithoutZombies()) going forward? Maybe a custom ESLint rule or something could be useful for this to prevent the bug from being reintroduced in the future.

Yes! There's a eslint rule by figma provided here: https://www.figma.com/plugin-docs/migrating-to-dynamic-loading/

we should add that

@six7 six7 merged commit cddfb5b into main Sep 18, 2024
11 checks passed
@six7 six7 deleted the fix/zombie-variables branch September 18, 2024 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong variables are applied and used for references
3 participants