mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-08 12:04:52 +10:00
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:
@@ -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),
|
||||
}));
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user