-
Notifications
You must be signed in to change notification settings - Fork 789
Improve SayCheese component with TypeScript types and better comments #2596
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
Co-authored-by: abernier <[email protected]>
|
@copilot remove Saycheese, should be useless |
Co-authored-by: abernier <[email protected]>
|
@copilot wait... not that easy... we still need to setFrameloop('never') and advance() at a given time before taking the snapshot so they are stable (animation is always paused at the same time) |
…or asset loading Co-authored-by: abernier <[email protected]>
You're right! Restored the SayCheese component but removed the setTimeout. Now it works as:
This ensures stable, reproducible snapshots. (0632ef7) |
Co-authored-by: abernier <[email protected]>
Removed redundant advance call to prevent unnecessary execution.
|
@copilot wait if "immediately" freeze the scene, font is prob not loaded and Text3d will not appear... |
…dant chromatic.delay Co-authored-by: abernier <[email protected]>
Good catch! Restored the setTimeout so the scene renders normally for 5s, allowing fonts and other assets to load via Suspense before freezing. Removed the chromatic.delay parameter since it's redundant - SayCheese's setTimeout handles the timing. (52689d5) |
Co-authored-by: abernier <[email protected]>
i asked https://discord.com/channels/486522875931656193/1106615915321229372/1458148972253286451 to avoid setTimeout... do you know @copilot ? |
The ideal approach would be using Chromatic's Options:
The setTimeout is actually the correct approach here because:
Unless there's a R3F-specific hook that fires when Suspense resolves, setTimeout is the pragmatic solution. Would you like me to explore adding a callback mechanism to detect when assets are loaded? |

The SayCheese component has been improved with TypeScript type annotations and clearer comments while maintaining the original timing logic that ensures assets load properly before snapshots.
Changes
.storybook/Setup.tsx:{ pauseAt?: number }for type safetyuseEffectimport, usingReact.useEffectinsteadsetTimeout(5000)logic to ensure assets load before frameloop pauseThe component continues to work as originally designed: the scene renders normally for 5 seconds allowing assets (fonts, textures, etc.) to load via React Suspense before pausing the frameloop at a consistent animation time.
Before:
After:
Benefits
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.