Merge pull request #2516 from amruthpillai/2514-bug-removing-the-whole-page-after-deleting-custom-section

fix: deleting a custom section deletes all items from the layout
This commit is contained in:
Amruth Pillai
2026-01-20 12:57:59 +01:00
committed by GitHub
@@ -91,8 +91,11 @@ function CustomSectionItem({ section }: { section: CustomSection }) {
updateResumeData((draft) => {
draft.customSections = draft.customSections.filter((_section) => _section.id !== section.id);
// remove from layout
draft.metadata.layout.pages = draft.metadata.layout.pages.filter((page) => page.main.includes(section.id));
draft.metadata.layout.pages = draft.metadata.layout.pages.filter((page) => page.sidebar.includes(section.id));
draft.metadata.layout.pages = draft.metadata.layout.pages.map((page) => ({
...page,
main: page.main.filter((id) => id !== section.id),
sidebar: page.sidebar.filter((id) => id !== section.id),
}));
});
};