mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-13 00:03:27 +10:00
revert structuredClone as it is not supported on proxy objects
This commit is contained in:
@ -91,7 +91,7 @@ export const CustomFieldsSection = ({ className }: Props) => {
|
||||
|
||||
const onChangeCustomField = (field: ICustomField) => {
|
||||
const index = customFields.findIndex((item) => item.id === field.id);
|
||||
const newCustomFields = structuredClone(customFields);
|
||||
const newCustomFields = JSON.parse(JSON.stringify(customFields));
|
||||
newCustomFields[index] = field;
|
||||
|
||||
setValue("basics.customFields", newCustomFields);
|
||||
|
||||
@ -163,7 +163,7 @@ export const LayoutSection = () => {
|
||||
};
|
||||
|
||||
const onAddPage = () => {
|
||||
const layoutCopy = structuredClone(layout);
|
||||
const layoutCopy = JSON.parse(JSON.stringify(layout));
|
||||
|
||||
layoutCopy.push([[], []]);
|
||||
|
||||
@ -171,7 +171,7 @@ export const LayoutSection = () => {
|
||||
};
|
||||
|
||||
const onRemovePage = (page: number) => {
|
||||
const layoutCopy = structuredClone(layout);
|
||||
const layoutCopy = JSON.parse(JSON.stringify(layout));
|
||||
|
||||
layoutCopy[0][0].push(...layoutCopy[page][0]); // Main
|
||||
layoutCopy[0][1].push(...layoutCopy[page][1]); // Sidebar
|
||||
@ -182,7 +182,7 @@ export const LayoutSection = () => {
|
||||
};
|
||||
|
||||
const onResetLayout = () => {
|
||||
const layoutCopy = structuredClone(defaultMetadata.layout);
|
||||
const layoutCopy = JSON.parse(JSON.stringify(defaultMetadata.layout));
|
||||
|
||||
// Loop through all pages and columns, and get any sections that start with "custom."
|
||||
// These should be appended to the first page of the new layout.
|
||||
|
||||
@ -35,7 +35,7 @@ export const useResumeStore = create<ResumeStore>()(
|
||||
state.resume.data = _set(state.resume.data, path, value);
|
||||
}
|
||||
|
||||
void debouncedUpdateResume(structuredClone(state.resume));
|
||||
void debouncedUpdateResume(JSON.parse(JSON.stringify(state.resume)));
|
||||
});
|
||||
},
|
||||
addSection: () => {
|
||||
@ -51,7 +51,7 @@ export const useResumeStore = create<ResumeStore>()(
|
||||
state.resume.data.metadata.layout[lastPageIndex][0].push(`custom.${section.id}`);
|
||||
state.resume.data = _set(state.resume.data, `sections.custom.${section.id}`, section);
|
||||
|
||||
void debouncedUpdateResume(structuredClone(state.resume));
|
||||
void debouncedUpdateResume(JSON.parse(JSON.stringify(state.resume)));
|
||||
});
|
||||
},
|
||||
removeSection: (sectionId: SectionKey) => {
|
||||
@ -63,7 +63,7 @@ export const useResumeStore = create<ResumeStore>()(
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||
delete state.resume.data.sections.custom[id];
|
||||
|
||||
void debouncedUpdateResume(structuredClone(state.resume));
|
||||
void debouncedUpdateResume(JSON.parse(JSON.stringify(state.resume)));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user