You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a problem! Because we will have the same token exist multiple times.
To reproduce:
Create a token with a name foo.bar and another token with a name otherfoo.bar
Right click the group foo and click Rename.
Enter otherfoo.
Now if you go to packages/tokens-studio-for-figma/src/plugin/node.ts in getTokenData and add a console log to output the stored token values on line 118: console.log('Getting tokens', values, themes, activeTheme, version, tokenFormat); you will see that there's actually 2 tokens with the same name.
So, when we perform getTokenData in packages/tokens-studio-for-figma/src/plugin/node.ts, after parsing the tokens array from the document, let's de-duplicate that array and prefer the last one appearing (because likely users had been editing tokens and that's the token they've seen)
This is another reason to rather use a map-based token storage everywhere, but for this issue, let's just make sure that we fix existing user's data that's on our users documents by de-duplicating before we pass it on. This should make sure that users won't have faulty data stored.
#2778 will prohibit this from appearing in the first place but we should fix our stored data with this issue.
The text was updated successfully, but these errors were encountered:
We had a bug that came with #2778 that basically means we store the same token name multiple times. Basically we had an array like this:
This is a problem! Because we will have the same token exist multiple times.
To reproduce:
foo.bar
and another token with a nameotherfoo.bar
foo
and clickRename
.otherfoo
.Now if you go to
packages/tokens-studio-for-figma/src/plugin/node.ts
ingetTokenData
and add a console log to output the stored token values on line 118:console.log('Getting tokens', values, themes, activeTheme, version, tokenFormat);
you will see that there's actually 2 tokens with the same name.So, when we perform
getTokenData
inpackages/tokens-studio-for-figma/src/plugin/node.ts
, after parsing the tokens array from the document, let's de-duplicate that array and prefer the last one appearing (because likely users had been editing tokens and that's the token they've seen)This is another reason to rather use a map-based token storage everywhere, but for this issue, let's just make sure that we fix existing user's data that's on our users documents by de-duplicating before we pass it on. This should make sure that users won't have faulty data stored.
#2778 will prohibit this from appearing in the first place but we should fix our stored data with this issue.
The text was updated successfully, but these errors were encountered: