Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 18, 2025

Problem

When importing variables from Figma, if the imported tokens were being added to a token set different from the currently viewed set, users would remain on their current set and wouldn't see the newly imported tokens. This created confusion as users expected to see the tokens they just imported.

For example, if a user was viewing the global token set and imported variables into collection/mode1, they would stay on the global view and not see any of the imported tokens.

Solution

This PR automatically switches the active token set to the first imported token set when the current set is not among the imported sets. This ensures users immediately see the tokens they just imported.

Behavior:

  • When clicking "Import All" in the import variables dialog, the system now:
    1. Collects all unique token sets from the imported tokens
    2. Checks if the currently active token set is in the list of imported sets
    3. If not, automatically switches to the first imported token set
    4. If yes, remains on the current set

Example:

// Current active set: "global"
// Importing tokens to: "collection/mode1", "collection/mode2"
// Result: Switches to "collection/mode1"

// Current active set: "global"  
// Importing tokens to: "global", "collection/mode1"
// Result: Stays on "global"

Changes

  • Modified ImportedTokensDialog.tsx to add automatic token set switching logic in the handleImportAllClick callback
  • Added 2 test cases to verify the switching behavior works correctly
  • Created changeset for version tracking

Testing

  • ✅ All existing tests pass (11/11 for ImportedTokensDialog)
  • ✅ New tests verify switching behavior in both scenarios
  • ✅ Linting passes
  • ✅ Build succeeds
  • ✅ No security vulnerabilities introduced

Fixes the issue where users wouldn't see their imported variables when they were added to a different token set than the currently viewed one.

Original prompt

When importing variables after import and when the set we were importing to is different than the one the user currently viewed, change the viewed set to the first new one that was imported into (could be a new or existing one)


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@changeset-bot
Copy link

changeset-bot bot commented Oct 18, 2025

🦋 Changeset detected

Latest commit: e94275e

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

…d sets

Co-authored-by: six7 <4548309+six7@users.noreply.github.com>
Copilot AI changed the title [WIP] Update viewed set when importing variables Switch to first imported token set when importing variables to a different set Oct 18, 2025
Copilot AI requested a review from six7 October 18, 2025 06:19
Copilot finished work on behalf of six7 October 18, 2025 06:19
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