Title: fix: keep Tiptap and editor APIs off published pages · Issue #549 · ycode/ycode · GitHub
Open Graph Title: fix: keep Tiptap and editor APIs off published pages · Issue #549 · ycode/ycode
X Title: fix: keep Tiptap and editor APIs off published pages · Issue #549 · ycode/ycode
Description: Summary Visitor-facing pages do not need the rich-text editor. They only need to render Tiptap JSON that was already saved. Despite LayerRendererPublic being split out from the builder renderer, the published bundle still includes: Tipta...
Open Graph Description: Summary Visitor-facing pages do not need the rich-text editor. They only need to render Tiptap JSON that was already saved. Despite LayerRendererPublic being split out from the builder renderer, th...
X Description: Summary Visitor-facing pages do not need the rich-text editor. They only need to render Tiptap JSON that was already saved. Despite LayerRendererPublic being split out from the builder renderer, th...
Opengraph URL: https://github.com/ycode/ycode/issues/549
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"fix: keep Tiptap and editor APIs off published pages","articleBody":"## Summary\n\nVisitor-facing pages do not need the rich-text **editor**. They only need to **render** Tiptap JSON that was already saved. Despite `LayerRendererPublic` being split out from the builder renderer, the published bundle still includes:\n\n- Tiptap / ProseMirror (`EditorState`, `EditorView`, `PluginKey`, `prosemirror-model`, `prosemirror-view`)\n- `RichTextLink` (`lib/tiptap-extensions/rich-text-link.ts`), which imports `@tiptap/core`\n- Editor/asset helpers from `lib/layer-utils.ts`, including `createComponentViaApi()` which calls `POST /ycode/api/components` (and pulls in `lodash/cloneDeep`)\n\nThese modules are **not required** to paint a published page. They inflate the public JS (see #548 — the duplicated ~499 KB chunks are this graph) and show up in Lighthouse as unused / editor-related code.\n\nRaised by a client website (14 Sep 2026 Lighthouse runs).\n\n## Import chain (published client)\n\n```\nLayerRendererPublic\n → lib/layer-utils.ts // 4.5k-line mixed module; includes createComponentViaApi\n → lib/text-format-utils.ts\n → lib/text-format-utils.ts // renderRichText\n → lib/tiptap-extensions/rich-text-link.ts // @tiptap/core Mark.create\n → lib/text-format-utils.ts // circular: DEFAULT_TEXT_STYLES\n → lib/variable-utils.ts\n → stringToTiptapContent from text-format-utils\n```\n\n`getLinkSettingsFromMark()` is a plain attrs mapper (~20 lines) and does not need `@tiptap/core`. It lives in the same file as the editor Mark, so importing it from the public renderer drags the editor in.\n\n`extractPlainTextFromTiptap` in `lib/tiptap-utils.ts` is already editor-free and is fine to keep.\n\n## What is required on the published site\n\n| Capability | Needed on published? | Notes |\n|---|---|---|\n| Render Tiptap JSON to React (`renderRichText`) | Yes | Keep; move off `@tiptap/core` |\n| `getLinkSettingsFromMark` | Yes | Extract to a tiny helper with no Tiptap import |\n| `@tiptap/react`, ProseMirror view/state, editor Marks/Nodes | No | Builder / canvas only |\n| `createComponentViaApi` / File Manager category helpers | No | Move out of `layer-utils` |\n| GSAP / Swiper / lightbox | Only if the page uses them | Already gated in `PageRenderer` |\n\n## Proposed fix\n\n- Move `getLinkSettingsFromMark` (and any other render-time helpers) out of `lib/tiptap-extensions/rich-text-link.ts` so the public renderer never imports `@tiptap/core`.\n- Split `lib/layer-utils.ts` (and `text-format-utils.ts` if needed) into render-safe vs builder-only modules. Public renderer should not import `createComponentViaApi`.\n- Optionally `next/dynamic` the rich-text renderer so pages with no `richText` layers skip it entirely.\n- Guardrail: fail CI / a bundle test if `@tiptap/core` or `prosemirror-view` appear in the published-route client graph.\n\n## Test plan\n\n- [ ] Grep / source-map of published chunks: no `@tiptap/core`, `prosemirror-view`, or `/ycode/api/components`\n- [ ] Rich text, CMS-bound text, and rich-text links still render on a published page\n- [ ] Creating a component from the builder still works (`createComponentViaApi`)\n- [ ] Combined with #548, duplicated JS in Lighthouse treemap is gone\n","author":{"url":"https://github.com/ysamcode","@type":"Person","name":"ysamcode"},"datePublished":"2026-09-15T05:43:55Z","url":"https://github.com/ycode/ycode/issues/549"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d7bedef3-1148-0fc7-39d8-56ca7a6f0daf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E6D6:2DDAAE:1BAD2B:256196:6AFE381B |
| html-safe-nonce | 77406c28fa6f4726d248bb233f572a800be7d5d7d6412ae44b2d59770533b829 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNkQ2OjJEREFBRToxQkFEMkI6MjU2MTk2OjZBRkUzODFCIiwidmlzaXRvcl9pZCI6Ijg4MjIzMDMwNzgwODIyOTQwMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 62e3df19fbfe4302d4712a15f0d1a65eda8a53541aad6d73105ecc20689ae040 |
| hovercard-subject-tag | issue:5458038756 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ycode/ycode/549/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c779d30660d06d9b1a1c91f7426e30fe6822bbf58cc9821730d4887b1c7bf1f3/ycode/ycode/issues/549 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c779d30660d06d9b1a1c91f7426e30fe6822bbf58cc9821730d4887b1c7bf1f3/ycode/ycode/issues/549 |
| og:image:alt | Summary Visitor-facing pages do not need the rich-text editor. They only need to render Tiptap JSON that was already saved. Despite LayerRendererPublic being split out from the builder renderer, th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ysamcode |
| hostname | github.com |
| expected-hostname | github.com |
| None | 260deedcf4630abb0a6b4aaa02fd2af70eab44d2529712694ceae59ca131b02e |
| turbo-cache-control | no-preview |
| go-import | github.com/ycode/ycode git https://github.com/ycode/ycode.git |
| octolytics-dimension-user_id | 65892203 |
| octolytics-dimension-user_login | ycode |
| octolytics-dimension-repository_id | 1165452593 |
| octolytics-dimension-repository_nwo | ycode/ycode |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1165452593 |
| octolytics-dimension-repository_network_root_nwo | ycode/ycode |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8b413ea7a9b010f4f2ebbb923b041b0d6091dd94 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width