fix(site-builder): re-read saved sections when the library opens

Refs #52

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Sonnet 5.5 committed 2026-10-07 11:54:53 -07:00
1 parent 6e819f1ef2
commit 7d24ca52fa
3 files changed
+18 -3

No files matched your search

@@ -100,4 +100,18 @@ describe('SectionLibraryModal', () => {
h.act(() => { ($('.section-lib-delete') as HTMLElement).click(); });
expect(extrasApi.get<any[]>('customSections', [])).toHaveLength(0);
});
test('sections loaded silently after mount (replaceAll) appear in My sections on open', () => {
mount();
// Mirrors useWhpApi: the project load calls replaceAll, which does not re-render.
h.act(() => {
extrasApi.replaceAll({
customSections: [{
id: 'custom-loaded', name: 'Loaded hero', family: 'custom', createdAt: 1,
tree: { type: { resolvedName: 'Section' }, props: {} },
}],
});
});
h.act(() => openSectionLibrary());
expect($$('.section-lib-card').map((c) => c.dataset.sectionId)).toContain('custom-loaded');
});
});