Context
PR #142 ports the EmailBuilder.js MUI sample with a module-level Zustand singleton (editorStateStore). That matches the upstream sample and PostKit’s supported embed model: a single EmailTemplateAdmin / EmailBuilderMuiSurface per page.
CodeRabbit flagged that mounting two editable surfaces would share document/selection/drawers and could cross-fire onChange.
Goal
- Create the store per surface instance
- Provide via React context
- Bind hooks/actions to the provider
- Add a regression test: two canvases, edit one, other document + callback unchanged
Non-goals
- Redesigning the admin catalog UX
- Changing the public
EmailTemplateAdmin API beyond what isolation requires
Parent: #138
Related: #142
Context
PR #142 ports the EmailBuilder.js MUI sample with a module-level Zustand singleton (
editorStateStore). That matches the upstream sample and PostKit’s supported embed model: a singleEmailTemplateAdmin/EmailBuilderMuiSurfaceper page.CodeRabbit flagged that mounting two editable surfaces would share document/selection/drawers and could cross-fire
onChange.Goal
Non-goals
EmailTemplateAdminAPI beyond what isolation requiresParent: #138
Related: #142