Skip to content

docs: defer the "No Figma link" hint until the entry is prepared#1090

Open
frankieyan wants to merge 1 commit into
mainfrom
frankie/figma-button-followup
Open

docs: defer the "No Figma link" hint until the entry is prepared#1090
frankieyan wants to merge 1 commit into
mainfrom
frankie/figma-button-followup

Conversation

@frankieyan

@frankieyan frankieyan commented Jun 29, 2026

Copy link
Copy Markdown
Member

Short description

This follow up fix to #1076 and #1080 eliminates a flash of the "No Figma link" badge on stories/docs pages off of a fresh page load. It does so by leveraging Storybook's getCurrentStoryData().prepared value off of its Context

Test plan

  • Run Storybook locally. In the steps below, don't just rely on the client-side routing, but reload each page instead
  • Navigate to a story that has a Figma link defined (e.g. Button) and reload
    • No "No Figma link" badge flashes before the Figma button appears
  • Navigate to a docs page with a Figma link (e.g. Avatar docs) and reload
    • No badge flash there either
  • Open a story/component with no figma param (e.g. Box) and reload
    • The "No Figma link" badge is rendered
  • Open a FIGMA_NOT_NEEDED story (e.g. KeyCapturer) and reload
    • Neither the badge nor the button are shown
  • Open an unattached-MDX docs page (e.g. a Tips & tricks page)
    • Neither the badge nor the button are shown

Demo

First load of a linked story (e.g. Button):

Before After
Screen.Recording.2026-06-29.at.7.40.53.PM.mov
Screen.Recording.2026-06-29.at.7.46.46.PM.mov

PR Checklist

  • Added tests for bugs / new features
  • Updated docs
  • Reviewed and approved Chromatic visual regression tests in CI

Co-Authored-By: Claude <noreply@anthropic.com>
@frankieyan frankieyan changed the title docs(storybook): defer the "No Figma link" hint until the entry is prepared docs: defer the "No Figma link" hint until the entry is prepared Jun 30, 2026
@frankieyan frankieyan marked this pull request as ready for review June 30, 2026 02:48
@frankieyan frankieyan added the 👀 Show PR Used for PRs that need a review, but can be merged when CI is green. label Jun 30, 2026

@doistbot doistbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This PR fixes the "No Figma link" badge flash on fresh page loads by gating the badge on Storybook's prepared flag, and updates the plop template to re-export FIGMA_NOT_NEEDED.

Few things worth tightening:

  • Exporting FIGMA_NOT_NEEDED from the ./figma barrel pulls a preview-side constant through an entrypoint that already re-exports FigmaTool, which depends on Storybook's manager API. Consider keeping story/preview consumers on a preview-safe path like ./constants or a dedicated preview export instead of widening this barrel.

Share FeedbackReview Logs

Comment thread .storybook/figma/index.ts Outdated
@frankieyan frankieyan force-pushed the frankie/figma-button-followup branch from 9d606bb to a89c639 Compare June 30, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

👀 Show PR Used for PRs that need a review, but can be merged when CI is green.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants