Skip to content

Master Sample App Fix - #27

Merged
yoen-velt merged 1 commit into
mainfrom
master-sample-app-fix
Dec 21, 2025
Merged

yoen-velt merged 1 commit into
mainfrom
master-sample-app-fix

Conversation

@yoen-velt

@yoen-velt yoen-velt commented Dec 21, 2025 •

Copy link
Copy Markdown
Contributor

Pull Request

Description

Type of Change

  • New demo application
  • Bug fix
  • Feature enhancement
  • Documentation update
  • Infrastructure/tooling change
  • Other (please describe):

Monorepo Structure Checklist

If adding a new demo, ensure you've followed the 5-level structure:

  • Placed in correct path: apps/<framework>/<document>/<type>/<implementation>/<library-or-solution>/<demo>/
  • Updated package.json with scoped name: @apps/<framework>-<document>-<library-or-solution>-<demo>
  • Created comprehensive README.md in the demo directory
  • Verified build passes: pnpm --filter <package-name> build
  • Verified dev server runs: pnpm --filter <package-name> dev

Deployment Checklist

If this demo should be deployed:

  • Added/updated Vercel project configuration
  • Updated GitHub Actions workflows (if applicable)
  • Verified deployment paths in CI/CD configs

Testing

  • Tested locally with pnpm -w install && pnpm -w build
  • Verified all affected apps still build
  • Tested dev servers for affected apps

Documentation

  • Updated relevant documentation (if needed)
  • Added demo to master-sample-app (if applicable)
  • Updated deployment docs (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

# Install dependencies
pnpm -w install

# Run the specific demo
pnpm --filter @apps/<package-name> dev

# Build the specific demo
pnpm --filter @apps/<package-name> build

Structure Verification

The demo follows the 5-level hierarchy:

  1. Framework:
  2. Document:
  3. Type:
  4. Implementation:
  5. Library/Solution:
  6. Demo:

Documentation: See README_MONOREPO.md and docs/structure.md for more details on the monorepo structure.


Note

Fix race when switching samples by clearing documentId before changing sample, and update URL only after new doc ID is set; wire Sidebar to the new handler.

  • App (apps/master-sample-app/app/[[...slug]]/page.tsx):
    • Sample switching: Add handleSampleSelect to clear documentId before updating currentSampleId to avoid iframe rendering with mismatched sample/doc.
    • URL management: Remove prior URL-sync effect and update URL within the sample-change effect after computing the new docId.
    • Sidebar: Pass onSampleSelect={handleSampleSelect} to Sidebar to use the new logic.

Written by Cursor Bugbot for commit 565a5b2. This will update automatically on new commits. Configure here.

@yoen-velt yoen-velt self-assigned this Dec 21, 2025
@vercel

vercel Bot commented Dec 21, 2025 •

Copy link
Copy Markdown

height="calc(100vh - 88px)"
displayMode={sample.metadata.displayMode || 'dual'}
key={documentId}
key={sample.metadata.id}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)

Fix in Cursor Fix in Web

}
}, [])

// Handle sample selection: clear documentId first to prevent race condition

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)

Fix in Cursor Fix in Web

This branch was successfully deployed

15 active deployments
Preview – sample-apps-ag-grid-multiple-tools — 565a5b2e Deployed Dec 21, 2025 by vercel[bot]
Preview – sample-apps-ag-grid-comment-aggregation — 565a5b2e Deployed Dec 21, 2025 by vercel[bot]
Preview – sample-apps-ag-grid-single-tool — 565a5b2e Deployed Dec 21, 2025 by vercel[bot]
Preview – sample-apps-tiptap-comments-demo — 565a5b2e Deployed Dec 21, 2025 by vercel[bot]
Preview – sample-apps-reactflow-demo — 565a5b2e Deployed Dec 21, 2025 by vercel[bot]
Preview – sample-apps-tanstack-comment-aggregation — 565a5b2e Deployed Dec 21, 2025 by vercel[bot]
Preview – sample-apps-tanstack-single-tool — 565a5b2e Deployed Dec 21, 2025 by vercel[bot]
Preview – sample-apps-tanstack-multiple-tools — 565a5b2e Deployed Dec 21, 2025 by vercel[bot]
Preview – sample-apps-tiptap-crdt-demo — 565a5b2e Deployed Dec 21, 2025 by vercel[bot]
Preview – sample-apps-codemirror-crdt-demo — 565a5b2e Deployed Dec 21, 2025 by vercel[bot]
Preview – sample-apps-slatejs-comments-demo — 565a5b2e Deployed Dec 21, 2025 by vercel[bot]
Preview – sample-apps-lexical-comments-demo — 565a5b2e Deployed Dec 21, 2025 by vercel[bot]
Preview – sample-apps-dashboard-demo — 565a5b2e Deployed Dec 21, 2025 by vercel[bot]
Preview – sample-apps-dashboard-mongo-db-demo — 565a5b2e Deployed Dec 21, 2025 by vercel[bot]
Preview – master-sample-app — 565a5b2e Deployed Dec 21, 2025 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant