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

1671 base font size token doesnt pick up tokens #1672

Merged
merged 9 commits into from
Mar 19, 2023

Conversation

swordEdge
Copy link
Contributor

@swordEdge swordEdge commented Mar 8, 2023

20230308_213841.mp4

@swordEdge swordEdge requested a review from six7 March 8, 2023 12:32
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

Commit SHA:360f6121550b1e59563746ccbb1e5ef39df88f2a

Test coverage results 🧪

Code coverage diff between base branch:main and head branch: 1671-base-font-size-token-doesnt-pick-up-tokens 
Status File % Stmts % Branch % Funcs % Lines
🟢 total 70.04 (0.02) 62.56 (0) 67.25 (0.02) 70.43 (0.02)
🟢 src/app/components/Tokens.tsx 79.45 (1.19) 68.57 (0) 65 (1.84) 78.57 (1.3)


let nameToLookFor = '';
if (aliasBaseFontSize) {
if (aliasBaseFontSize.startsWith('{')) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldnt we already have the value of aliasBaseFontSize in settings? you query on line 197 of Tokens.tsx the aliasValue? That should be the real value to be used, right? No need to further query the alias value of it'd already be in store?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

shouldnt we already have the value of aliasBaseFontSize in settings? you query on line 197 of Tokens.tsx the aliasValue? That should be the real value to be used, right? No need to further query the alias value of it'd already be in store?

@six7 Yes. We store the real value to be used. But when we switch the theme, it causes the document update. But at this time, the real value has not been updated yet. It will be updated after this process. That's why I resolved the aliasValue here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Then dont we have a function to getAliasVallue? I feel we shouldnt have alias resolve logic in node.ts - we should import a function that does it.

Or even better, make sure that by the time the document updates the base font size token has been updated

@six7 six7 linked an issue Mar 12, 2023 that may be closed by this pull request
@@ -196,6 +196,7 @@ export const settings = createModel<RootModel>()({
},
setBaseFontSize: (payload, rootState) => {
setUI(rootState.settings);
dispatch.tokenState.updateDocument({ shouldUpdateNodes: true });
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you set this to shouldUpdateNodes: false?

We wouldnt want a change in the base font size trigger a document wide update, which could mean the users would have to wait a long time. So instead lets just update the document, but not the nodes.

@swordEdge swordEdge requested a review from six7 March 17, 2023 13:38
@six7 six7 merged commit 1325d8f into main Mar 19, 2023
@SorsOps SorsOps deleted the 1671-base-font-size-token-doesnt-pick-up-tokens branch July 6, 2023 11:59
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.

Base font size token doesn't pick up tokens
2 participants