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

Fixes remove styles logic #3123

Merged
merged 5 commits into from
Sep 10, 2024
Merged

Fixes remove styles logic #3123

merged 5 commits into from
Sep 10, 2024

Conversation

six7
Copy link
Collaborator

@six7 six7 commented Sep 5, 2024

This changes the logic around removing styles and variables without connection to a token. What we did before was we looked at each theme individually, looked at the tokens created in that go, and then removed any styles that were untouched.

This was flawed as it did not take into account other themes in the same session.

Changed this to look at all themes created, combine their created style ids, and only then remove any that were untouched.

To test this,

  • create a few tokens with variable connections spread out across themes (e.g. a Core, and a Mode/Light, Mode/Dark)
  • export using Remove styles...
  • Notice how it now no longer removes created styles right after creating them.
    Before, it did - especially if you were only exporting one of your themes - all other styles were always removed. Note this only applies to Styles, not variables!
CleanShot.2024-09-06.at.09.29.56.mp4
CleanShot.2024-09-06.at.10.04.10.mp4

Copy link

changeset-bot bot commented Sep 5, 2024

🦋 Changeset detected

Latest commit: 98b72fa

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 5, 2024

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

Copy link
Contributor

github-actions bot commented Sep 5, 2024

Commit SHA:93b4a88c90abb2a4ef7a4dcd5d5164c58bce3445

Test coverage results 🧪

Code coverage diff between base branch:main and head branch: six7/fix-remove-styles 
Status File % Stmts % Branch % Funcs % Lines
🔴 total 67.8 (-0.13) 58.49 (-0.09) 64.44 (-0.13) 68.21 (-0.14)
🔴 packages/tokens-studio-for-figma/src/app/store/useTokens.tsx 51.89 (-3.02) 33.84 (-2.82) 53.73 (-1.65) 52.72 (-3.31)
🟢 packages/tokens-studio-for-figma/src/plugin/controller.ts 98.03 (0.03) 100 (0) 75 (0) 100 (0)
🔴 packages/tokens-studio-for-figma/src/plugin/updateStyles.ts 92.3 (-1.45) 83.33 (-1.04) 100 (0) 94.73 (-1.27)
✨ 🆕 packages/tokens-studio-for-figma/src/plugin/asyncMessageHandlers/removeStylesWithoutConnection.ts 9.09 0 0 9.09

Copy link
Contributor

github-actions bot commented Sep 5, 2024

Commit SHA:93b4a88c90abb2a4ef7a4dcd5d5164c58bce3445
Current PR reduces the test coverage percentage by 1 for some tests

@six7 six7 marked this pull request as ready for review September 6, 2024 07:10
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

@six7 six7 merged commit 2c60963 into main Sep 10, 2024
11 of 12 checks passed
@six7 six7 deleted the six7/fix-remove-styles branch September 10, 2024 11:07
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.

2 participants