Repository navigation
Master Sample App Fix - #27
Conversation
| height="calc(100vh - 88px)" | ||
| displayMode={sample.metadata.displayMode || 'dual'} | ||
| key={documentId} | ||
| key={sample.metadata.id} |
There was a problem hiding this comment.
Iframe reset fails to remount due to key change
The key prop on IframePair was changed from documentId to sample.metadata.id. This breaks the reset functionality - when handleReset generates a new documentId for the same sample, the iframe no longer remounts because the key remains unchanged. The iframe just updates its src attribute instead of being fully recreated. For collaborative demos with WebSocket connections or internal state, this may cause the "Reset" button to not properly provide a fresh start.
Additional Locations (1)
| } | ||
| }, []) | ||
|
|
||
| // Handle sample selection: clear documentId first to prevent race condition |
There was a problem hiding this comment.
URL not updated with documentId on default sample load
The removed effect that ran on documentId change was responsible for updating the URL after initialization. The new sample change effect only runs when currentSampleId changes. When loading the root path with the default sample (where targetSampleId === currentSampleId), setCurrentSampleId is not called, so the sample change effect never runs and the URL is never updated with the documentId. This breaks the share/collaboration feature since users cannot copy a URL containing the document ID.
Additional Locations (1)
2bb3713 to
565a5b2
Compare
Pull Request
Description
Type of Change
Monorepo Structure Checklist
If adding a new demo, ensure you've followed the 5-level structure:
apps/<framework>/<document>/<type>/<implementation>/<library-or-solution>/<demo>/package.jsonwith scoped name:@apps/<framework>-<document>-<library-or-solution>-<demo>pnpm --filter <package-name> buildpnpm --filter <package-name> devDeployment Checklist
If this demo should be deployed:
Testing
pnpm -w install && pnpm -w buildDocumentation
master-sample-app(if applicable)Related Issues
Screenshots/Videos
Additional Context
For Reviewers
Demo Location
Path:
apps/<framework>/<document>/<type>/<implementation>/<library-or-solution>/<demo>/Package name:
@apps/<...>How to Test
Structure Verification
The demo follows the 5-level hierarchy:
Documentation: See README_MONOREPO.md and docs/structure.md for more details on the monorepo structure.
Note
Fix race when switching samples by clearing
documentIdbefore changing sample, and update URL only after new doc ID is set; wireSidebarto the new handler.apps/master-sample-app/app/[[...slug]]/page.tsx):handleSampleSelectto cleardocumentIdbefore updatingcurrentSampleIdto avoid iframe rendering with mismatched sample/doc.docId.onSampleSelect={handleSampleSelect}toSidebarto use the new logic.Written by Cursor Bugbot for commit 565a5b2. This will update automatically on new commits. Configure here.