Skip to content

fix(design-system): correct figma node ids and docs snippet race [AR-83527] - #697

Open
mmurawski-dn wants to merge 3 commits into
drivenets:mainfrom
mmurawski-dn:drivenets/michal/AR-83527-fix-ci-checks
Open

fix(design-system): correct figma node ids and docs snippet race [AR-83527]#697
mmurawski-dn wants to merge 3 commits into
drivenets:mainfrom
mmurawski-dn:drivenets/michal/AR-83527-fix-ci-checks

Conversation

@mmurawski-dn

Copy link
Copy Markdown
Collaborator

Fixes two unrelated CI failures.

1. Figma Code Connect validation

figma:publish failed validation on two nodes:

  • DsModal.Footer pointed at 32014-16402, which is use-case=small-modals — a variant inside the component set Part_modal-footer_V2 (43101:8753). Code Connect must target the set. The other three modal files already do.
  • DsMainMenu pointed at 42100-7474, which is Main Menu Navigation_v2 — a plain frame, not a component, so there was nothing to attach to. Repointed at the published Main Menu Navigation_v01 (20895:43484), which has the same children.

Verified with figma connect publish --dry-run: All Code Connect files are valid.

Note

Main Menu Navigation_v2 looks like it was linked before it was componentized. If v2 is meant to supersede v01, design should convert that frame to a published component and we swap the id again.

2. Storybook docs snippet race

Storybook Docs Tests was failing intermittently on changeset-release/main — a bot PR touching only changesets, CHANGELOGs and version fields, so it could not have changed a snippet. A different component failed each run (ds-date-range-picker, then ds-comments-drawer), and other runs on the same commit passed.

Both failures had the same signature — expected JSX, received the raw story object:

- <DsDateRangePicker            + {
-   slotProps={{                +   args: {

Cause

Autodocs fills a story's "Show code" panel in two passes:

  1. The static source the CSF plugin extracted (the story object literal).
  2. The generated JSX, once the story's effect runs jsxDecoratoremitTransformCode, which is async and emits SNIPPET_RENDERED at least a microtask after the story's DOM is committed.

readShowCodeSnippet only waited for the panel to be visible and non-empty — both already true in pass 1 — so under CI load it captured the story object. Waiting on the canvas render does not help: the canvas is committed before the snippet exists.

Fix

Wait for the state transition itself:

  • An init script records which story ids have emitted SNIPPET_RENDERED.
  • Before reading, ask Storybook's preview store whether this story will produce a snippet at all, mirroring the renderer's own skipJsxRender. Stories with source: { type: 'code' } or a bare render that ignores args never emit — for them the static source is the final value.
  • Only stories that will emit wait, and they wait on the event rather than a timeout.

Verification

Reproduced the race by delaying the snippet event, then compared old vs new logic:

story logic waited captured
Custom Labels (dynamic) old 0ms { ← the CI failure
Custom Labels (dynamic) new 3565ms <DsDateRangePicker
Controlled (type: 'code') old 0ms {
Controlled (type: 'code') new 4ms {

Full suite run twice locally: 56/56 passed both times, no snapshot drift. Runtime dropped from ~214s to ~128s, because stories that never emit no longer wait.

@netlify

netlify Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deploy Preview for drivenets-design-system ready!

Name Link
🔨 Latest commit d20b6db
🔍 Latest deploy log https://app.netlify.com/projects/drivenets-design-system/deploys/6a9fc095a009350008dbf409
😎 Deploy Preview https://deploy-preview-697--drivenets-design-system.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant