Hahn-Solo Product Management
  • Dashboard
  • Technologies
  • Competitors
  • Tasks
Theme
Basic Information
Status
Open
Priority
Now
Category
Bug Fix
Repo
Content SDK PM
Effort
Moderate
Task ID
T-E20D6829
Details
Fix SSG Editing Draft Mode Crash
Investigate and fix issue #415 where App Router SSG editing fails in draft mode due to `variantIds.split()` being called on undefined when a prerendered route drops preview parameters. The fix likely requires a null check in the editing data handler before calling `.split()`.
Why
This affects the core editing experience in SitecoreAI Pages for App Router projects using SSG. Broken editing undermines the visual editing value proposition that competes with Storyblok's editor benchmark.
Evidence
GitHub issue #415 (opened 2026-03-24, label: bug)
Details
Context: Issue #415 reports that App Router SSG editing fails in draft mode when a prerendered route path drops preview parameters, causing `variantIds` to be `undefined`. The code calls `.split()` on this undefined value, crashing the `getPreview` function. This directly impacts the editing experience in SitecoreAI Pages for projects that use static generation with App Router.

Steps:
1. Reproduce: create an App Router project with SSG pages, enable draft mode editing in SitecoreAI Pages, navigate to a prerendered route
2. Trace the crash to the `getPreview` function -- locate where `variantIds.split()` is called
3. Add a defensive null/undefined check: `const variants = variantIds ? variantIds.split(',') : []`
4. Add a unit test that covers the undefined `variantIds` case
5. Test in SitecoreAI Pages editing mode with both SSG and SSR routes

Acceptance criteria:
SSG pages can be edited in draft mode without crashing
Unit test covers the `variantIds === undefined` path
No regression in SSR editing or personalization variant resolution

Risks: The fix may mask a deeper issue with how preview parameters are propagated to prerendered routes. Investigate whether the parameters should have been present rather than just guarding against their absence.
Source Report
reports/product-management/content-sdk/2026-04-05-content-sdk-pm.md
Report date: Apr 5, 2026