In-App Documentation Pages No Longer Error; Cleaner Share-by-Email Loading
Executive summary
Reached QA. This release fixes the in-app Documentation (/docs) section that was intermittently returning a 500 error, and resolves a build-time warning around the rich-text editor used by the "Share via Email" dialog. Documentation pages now load reliably and refresh their content automatically every five minutes.
Why this was needed
The Documentation pages were rendering a 500 error because the data-fetching code was being used in a way Next.js treats as invalid during static/server rendering, breaking the docs experience embedded in the dashboard. Separately, the rich-text editor (CKEditor) powering the "Share via Email" dialog was being loaded on the server, which produced duplicated-module errors in the build logs and added unnecessary risk to the mail detail pages.
Client / user impact
- Users can open the in-app Documentation section (
/docs, individual articles, and tag pages) without hitting the 500 error. - Documentation content now updates on its own roughly every 5 minutes, so published edits appear without a redeploy.
- The "Share via Email" dialog on mail and batch-mail detail pages continues to work, with the heavy editor now loaded only when needed in the browser. Cleaner builds reduce the chance of editor-related regressions.
Technical scope
- Added a new server-only
documentation.server.services.tsthat fetches Strapi content with Next.js ISR caching (next.revalidate, 300s), avoiding theDYNAMIC_SERVER_USAGEcondition that caused the/docs500s. - Re-pointed the docs landing, layout, article (
[slug]), and tag pages to this server service and addedexport const revalidate = 300to article and tag pages. - Extracted all Strapi mapping/normalization and type-guard helpers into a shared
documentation.mappers.ts(349 lines), and removed the duplicated copies from the existingdocumentation.services.tsso client and server services share one implementation (no behavior change to mapping). - On
mails/[id]andbatches/mails/[id], switchedShareViaMailDialogto a dynamic, client-only import (ssr: false) so the CKEditor bundle is never evaluated in Node, eliminating duplicated-module build errors.
Risk & mitigation
Low-to-moderate. The docs data layer was duplicated into a new server service rather than reused, so any mapping divergence would surface as wrong/missing docs content; mitigated because mapping logic is now centralized in one shared file. The ssr: false change means the share dialog renders only after client hydration; verify it still opens. ISR caching means content can be up to 5 minutes stale by design.
QA validation focus
- Open
/docs, a specific article (/docs/<slug>), and a tag page (/docs/tags/<slug>) and confirm no 500 error; verify breadcrumbs, navigation (prev/next), and sidebar render. - Publish/edit a doc in the CMS and confirm the change appears within ~5 minutes without redeploy.
- On a mail detail page and a batch mail detail page, open "Share via Email" and confirm the editor loads and a share can be sent.
- Confirm build/server logs no longer show CKEditor duplicated-module errors.