docs(examples): add SolidJS example to "/getting-started/frameworks/solid`#3353
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a9b2d7a1c4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| console.log('ProseMirror editor created:', event); | ||
| }, | ||
| onEditorUpdate: ({ editor }) => { | ||
| console.log('Document updated', editor.on('document-mode', () => {console.log(123)})); |
There was a problem hiding this comment.
Remove per-update event subscription in onEditorUpdate
The onEditorUpdate callback currently calls editor.on('document-mode', ...) on every document update, which creates a new listener each time the user types. In this example that means listener count grows unbounded during editing, and later mode changes will trigger all accumulated callbacks, causing duplicated side effects and avoidable memory/performance issues. This should only log/update state directly in onEditorUpdate, or register the document-mode listener once during initialization with a corresponding cleanup.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Removed this. That was a leftover code from me trying to setup bi-directional documentMode change between consumer component (App.tsx) and internal toolbar.
By default, when you change a mode with setDocumentMode() it reactively changes mode in the internal toolbar as well, which is reflected in the toolbar's "mode change" button re-rendering. This is not the case when the opposite happens: when the mode is changed in the internal toolbar – there's no external callback setup from within the toolbar to the consumer to cause the reactive change.
Initially, I've tried a few things but then I've noticed the behaviour is identical in React's version as well so I stopped pursuing that.
…inding for documentMode change
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
- Add getting-started-solid entry to examples/manifest.json (required by examples/AGENTS.md) - Add solid to the getting-started matrix in .github/workflows/ci-examples.yml so the Playwright smoke covers it - Note in the Solid docs page that SuperDoc does not ship a first-party Solid wrapper
caio-pizzol
left a comment
There was a problem hiding this comment.
Hey @msviderok, thanks for this. I ran the example locally: file upload, edit/suggest/view mode switching, export, and Get HTML all worked. The Solid lifecycle wiring with createEffect + onCleanup looks clean.
I pushed a follow-up commit with two repo-contract fixes:
- Added
getting-started-solidtoexamples/manifest.json. - Added
solidto thegetting-startedmatrix in.github/workflows/ci-examples.yml.
The Playwright harness already resolves EXAMPLE=solid to examples/getting-started/solid and defaults to port 5173, so no extra wiring was needed.
I also added a short docs note clarifying that SuperDoc does not ship a first-party Solid wrapper. Solid users should use the core superdoc package directly, and community wrappers can build on top of it.
|
@caio-pizzol that's great news, Caio! Thank you a lot! |
Summary
pnpm create solidwith the default "SolidJS + TypeScript" template/getting-started/frameworks/solidpage to the docs.Test Plan
pnpm installpnpm -C examples/getting-started/solid devDemo
Video comparison of
examples/{react|solid}solidjs_example.mp4
Snapshot of
/getting-started/frameworks/soliddocs pageClick to view the full page
