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.