refactor(examples): improve examples app, reorganize examples#7957
refactor(examples): improve examples app, reorganize examples#7957steveruizok merged 6 commits intomainfrom
Conversation
Move example directories into category-based subfolders (collaboration, configuration, data/assets, editor-api, events, getting-started, layout, shapes/tools, ui, use-cases) so category is derived from the folder structure rather than frontmatter. Lazy-load README content to reduce initial bundle size, remove unused useMergedRefs hook, and remove the category/hide frontmatter fields from all README files.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
Move the new example added on main into the category subfolder structure and remove the category frontmatter field.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
branching-chat-template | 8a6caa1 | Commit Preview URL Branch Preview URL |
Feb 16 2026, 12:42 AM |
…ory folders The test was reading the top-level examples directory expecting slug names, but after reorganization it now contains category folders. Recursively walk the directory tree to find actual example slugs by looking for README.md files.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| @@ -26,7 +26,7 @@ setDefaultEditorAssetUrls(assetUrls) | |||
| setDefaultUiAssetUrls(assetUrls) | |||
| const gettingStartedExamples = examples.find((e) => e.id === 'Getting started') | |||
| if (!gettingStartedExamples) throw new Error('Could not find getting started examples') | |||
| const basicExample = gettingStartedExamples.value.find((e) => e.title === 'Tldraw component') | |||
| const basicExample = gettingStartedExamples.value[0] | |||
There was a problem hiding this comment.
Fragile array indexing replaces explicit example lookup
Medium Severity
The code changed from explicitly finding the example by title (find((e) => e.title === 'Tldraw component')) to implicitly taking the first sorted element (value[0]). This is fragile and will break if any getting-started example is added with lower priority or with priority 0 and an alphabetically earlier title. The explicit search was more robust and maintainable.
…erties table Updated the release notes guide to fix table formatting for PR categorization and improved the layout of the example properties section in the writing examples documentation. Ensured consistent alignment and clarity in both documents.
Updated the ExampleMetaModule definition in examples.tsx to use an interface instead of a type, enhancing type extensibility and clarity in the codebase.
followup to #7957 was causing docs builds to fail: ``` Error: ENOENT: no such file or directory, open '/Users/mime/Sites/tldraw/apps/examples/src/examples/collaboration/README.md' at Object.openSync (node:fs:559:18) at Object.readFileSync (node:fs:443:35) at generateSection ``` ### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other` <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Limited to docs content generation logic; main risk is misclassification or missing example articles if the expected folder structure differs. > > **Overview** > Fixes docs build failures when generating the `examples` section by changing article discovery to **recursively locate `README.md` files** instead of assuming a flat directory layout. > > This refactors `generateSection` to use explicit article source lists (`getRegularArticleSources` vs `getExampleArticleSources`), derives example `articleId`/`categoryId` from folder paths, and allows `getArticleData` to accept a category override so example category assignment no longer depends on frontmatter. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 8dd4f97. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Closes #8099 PR #7957 reorganized examples from flat `apps/examples/src/examples/{name}` into category subdirectories (`shapes/tools/`, `data/assets/`, `events/`, `ui/`, etc.). All ~115 "Related examples" GitHub links across 40 docs files now 404. This PR updates every link to use the new paths. Also fixes 2 misnamed example references in `default-shapes.mdx`: - `custom-styles` → `shapes/tools/shape-with-custom-styles` - `shape-options` → `configuration/configure-shape-util` @steveruizok we sometimes point to hosted examples and sometimes to code on github, not sure if intentional or not? ### Change type - [x] `bugfix` ### Test plan 1. Open any docs page with "Related examples" links (e.g. `/sdk-features/shapes`, `/sdk-features/tools`, `/sdk-features/deep-links`) 2. Click the GitHub example links 3. Verify they resolve to the correct example directory on GitHub ### Release notes - Fix ~115 broken GitHub example links across SDK documentation <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: documentation-only changes that update URLs and a couple of example name corrections, with no runtime or API impact. > > **Overview** > Fixes SDK docs and release notes that linked to example directories that were moved in the examples reorg. > > Updates "Related examples" links across many `sdk-features/*.mdx` pages to point at the new categorized paths (e.g. `ui/`, `events/`, `configuration/`, `editor-api/`, `shapes/tools/`, `data/assets/`, `use-cases/`, `layout/`). Also corrects a couple of misnamed example references in `default-shapes.mdx` and updates the v4.3.0 release note link for the pin bindings example. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit de7a306. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Closes #8099 PR #7957 reorganized examples from flat `apps/examples/src/examples/{name}` into category subdirectories (`shapes/tools/`, `data/assets/`, `events/`, `ui/`, etc.). All ~115 "Related examples" GitHub links across 40 docs files now 404. This PR updates every link to use the new paths. Also fixes 2 misnamed example references in `default-shapes.mdx`: - `custom-styles` → `shapes/tools/shape-with-custom-styles` - `shape-options` → `configuration/configure-shape-util` @steveruizok we sometimes point to hosted examples and sometimes to code on github, not sure if intentional or not? ### Change type - [x] `bugfix` ### Test plan 1. Open any docs page with "Related examples" links (e.g. `/sdk-features/shapes`, `/sdk-features/tools`, `/sdk-features/deep-links`) 2. Click the GitHub example links 3. Verify they resolve to the correct example directory on GitHub ### Release notes - Fix ~115 broken GitHub example links across SDK documentation <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: documentation-only changes that update URLs and a couple of example name corrections, with no runtime or API impact. > > **Overview** > Fixes SDK docs and release notes that linked to example directories that were moved in the examples reorg. > > Updates "Related examples" links across many `sdk-features/*.mdx` pages to point at the new categorized paths (e.g. `ui/`, `events/`, `configuration/`, `editor-api/`, `shapes/tools/`, `data/assets/`, `use-cases/`, `layout/`). Also corrects a couple of misnamed example references in `default-shapes.mdx` and updates the v4.3.0 release note link for the pin bindings example. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit de7a306. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->


In order to make the examples app easier to navigate and maintain, this PR reorganizes all example directories into category-based subfolders so that the category is derived from the folder structure rather than from frontmatter metadata.
Key changes:
collaboration,configuration,data/assets,editor-api,events,getting-started,layout,shapes/tools,ui, anduse-casescategoryfrom the folder path instead of requiring it in README frontmattercategoryandhidefrontmatter fields from all README filesuseMergedRefshookwriting-examples.mdto document the new folder structure conventionChange type
improvementTest plan
yarn devand open the examples app at localhost:5420Release notes
Note
Medium Risk
Touches example discovery/build-time transforms and routing assumptions; regressions would mainly surface as missing/incorrect examples or broken info dialogs/paths rather than core SDK behavior.
Overview
Examples are now discovered from nested
src/examples/**/README.mdpaths, with category derived from the folder structure (including slash categories likeshapes/tools) instead ofREADME.mdfrontmatter; all READMEs removecategory/hidefields and the build validates categories.Example README handling is refactored in Vite to export
metaplusloadComponent(), and addsloadContent()to lazy-load description/details only when the info dialog opens (UI updated accordingly). Routing/E2E utilities are updated to use slug-only URLs despite nested folders, a couple example imports are fixed for the new paths, and an unuseduseMergedRefshook is removed; docs are updated to reflect the new structure.Written by Cursor Bugbot for commit 36b1b3a. This will update automatically on new commits. Configure here.