Describe the bug
The plugin fails to render tokens with the error t.name.split is not a function when a token group in the JSON contains two child tokens whose keys are "name" and "value" at the same level. The parser handles the JSON correctly, but the UI's isSingleToken heuristic in src/utils/is/isSingleToken.ts then misidentifies the parent group as a single token (because the group itself ends up with name and value as direct properties via the lodash-set tree rebuild in createTokenObj), and a downstream useMemo calls .split on what it thinks is a string but is actually a child token object.
Reported by a customer. Reproduced 100% on production v2.11.5.
To Reproduce
Steps to reproduce the behavior:
- Host the JSON from the "JSON" section below on a public URL (e.g. a public GitHub Gist).
- In the plugin: Settings → Add new sync → URL.
- Paste the raw URL and click Save.
- Plugin renders nothing and shows the "An unexpected error has occurred — t.name.split is not a function" screen. Console shows a React ErrorBoundary stack trace pointing at
useMemo (not the parser).
Expected behavior
A token group containing children keyed "name" and "value" should be rendered as a group (recursing into the children), not misidentified as a single token. Either the isSingleToken check should be tightened (e.g. require typeof token.name === 'string' or also require 'type' in token), or the tree rebuild in createTokenObj should not produce intermediate nodes that satisfy the current check.
Screenshots or Screencasts
JSON (optional)
{
"included-link": {
"contract": {
"chip": {
"text": {
"label": {
"default": { "value": { "fontFamily": "Inter" }, "type": "typography" },
"link": { "value": { "fontFamily": "Inter" }, "type": "typography" },
"name": { "value": { "fontFamily": "Inter" }, "type": "typography" },
"thin": { "value": { "fontFamily": "Inter" }, "type": "typography" },
"value": { "value": { "fontFamily": "Inter" }, "type": "typography" }
}
}
}
}
}
}
Describe the bug
The plugin fails to render tokens with the error
t.name.split is not a functionwhen a token group in the JSON contains two child tokens whose keys are"name"and"value"at the same level. The parser handles the JSON correctly, but the UI'sisSingleTokenheuristic insrc/utils/is/isSingleToken.tsthen misidentifies the parent group as a single token (because the group itself ends up withnameandvalueas direct properties via the lodash-set tree rebuild increateTokenObj), and a downstreamuseMemocalls.spliton what it thinks is a string but is actually a child token object.Reported by a customer. Reproduced 100% on production v2.11.5.
To Reproduce
Steps to reproduce the behavior:
useMemo(not the parser).Expected behavior
A token group containing children keyed
"name"and"value"should be rendered as a group (recursing into the children), not misidentified as a single token. Either theisSingleTokencheck should be tightened (e.g. requiretypeof token.name === 'string'or also require'type' in token), or the tree rebuild increateTokenObjshould not produce intermediate nodes that satisfy the current check.Screenshots or Screencasts
JSON (optional)
{ "included-link": { "contract": { "chip": { "text": { "label": { "default": { "value": { "fontFamily": "Inter" }, "type": "typography" }, "link": { "value": { "fontFamily": "Inter" }, "type": "typography" }, "name": { "value": { "fontFamily": "Inter" }, "type": "typography" }, "thin": { "value": { "fontFamily": "Inter" }, "type": "typography" }, "value": { "value": { "fontFamily": "Inter" }, "type": "typography" } } } } } } }