A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
fix: preserve canonical order through partial imports
Amruth Pillai8477e2f3085c
diff --git a/apps/web/src/features/resume/editor/write/picture-settings.test.tsx b/apps/web/src/features/resume/editor/write/picture-settings.test.tsxindex 5ec11d93f..b2d41ba5e 100644--- a/apps/web/src/features/resume/editor/write/picture-settings.test.tsx+++ b/apps/web/src/features/resume/editor/write/picture-settings.test.tsx@@ -245,6 +245,8 @@ it.each(["current", "resume", "locked", "account"])(size: 144,});else expect(useResumeStore.getState().resume).toBe(before);+ expect(mocks.toast).toHaveBeenCalledTimes(1);+ if (scenario !== "resume") expect(mocks.closeToast).toHaveBeenCalledWith("photo-toast");client.clear();},);diff --git a/apps/web/src/features/resume/editor/write/picture-settings.tsx b/apps/web/src/features/resume/editor/write/picture-settings.tsxindex 225d9ea25..d24cd1aeb 100644--- a/apps/web/src/features/resume/editor/write/picture-settings.tsx+++ b/apps/web/src/features/resume/editor/write/picture-settings.tsx@@ -718,6 +718,7 @@ export function PictureSettings({ locked }: PictureSettingsProps) {onSuccess: ({ url }) => {toast.close(toastId);if (!current()) return;+ form.setFieldValue("url", url);updateResumeData((draft) => {draft.picture.url = url;diff --git a/packages/import/src/reactive-resume-json.test.ts b/packages/import/src/reactive-resume-json.test.tsindex 3b82b3b4d..4a6e828e1 100644--- a/packages/import/src/reactive-resume-json.test.ts+++ b/packages/import/src/reactive-resume-json.test.ts@@ -9,7 +9,15 @@ describe("parseReactiveResumeJSON", () => {const result = parseReactiveResumeJSON(JSON.stringify(data));expect(result.metadata.layout.pages.length).toBe(1);- expect(result.metadata.layout.pages[0]?.main.length).toBeGreaterThan(0);+ expect(result.metadata.layout.pages[0]?.main.slice(0, 4)).toEqual([+ "summary",+ "experience",+ "education",+ "projects",+ ]);+ expect(result.metadata.layout.pages[0]?.main.indexOf("profiles")).toBeGreaterThan(+ result.metadata.layout.pages[0]?.main.indexOf("references") ?? -1,+ );});it("recovers missing built-in sections by appending them to the first page", () => {@@ -34,5 +42,7 @@ describe("parseReactiveResumeJSON", () => {// The originally-placed sections remain where the user put them.expect(firstPage?.sidebar).toContain("skills");expect(firstPage?.main[0]).toBe("experience");+ expect(firstPage?.sidebar).toEqual(["skills"]);+ expect(firstPage?.main.indexOf("profiles")).toBeGreaterThan(firstPage?.main.indexOf("education") ?? -1);});});diff --git a/packages/import/src/reactive-resume-json.tsx b/packages/import/src/reactive-resume-json.tsxindex d0bf161ba..5fcf231db 100644--- a/packages/import/src/reactive-resume-json.tsx+++ b/packages/import/src/reactive-resume-json.tsx@@ -1,8 +1,12 @@import type { ResumeData } from "@reactive-resume/schema/resume/data";-import { resumeDataSchema, sectionTypeSchema } from "@reactive-resume/schema/resume/data";+import { resumeDataSchema } from "@reactive-resume/schema/resume/data";+import { defaultResumeData } from "@reactive-resume/schema/resume/default";import { rethrowAsImportError } from "./error";-const BUILT_IN_LAYOUT_SECTION_IDS = sectionTypeSchema.options.filter((section) => section !== "cover-letter");+const BUILT_IN_LAYOUT_SECTION_IDS = defaultResumeData.metadata.layout.pages.flatMap(({ main, sidebar }) => [+ ...main,+ ...sidebar,+]);/** Recovers built-in sections missing from the layout (or a layout with no pages) without reordering it. */function normalizeBuiltInSectionsInLayout(data: ResumeData): ResumeData {diff --git a/packages/ui/src/components/form.test.tsx b/packages/ui/src/components/form.test.tsxindex e71521e13..34d0c4fca 100644--- a/packages/ui/src/components/form.test.tsx+++ b/packages/ui/src/components/form.test.tsx@@ -47,6 +47,21 @@ describe("FormControl", () => {expect(sliderInput.getAttribute("aria-labelledby")).toBe(labelId);});+ it("bridges generated slider description and errors to the real input", () => {+ render(+ <FormItem hasError>+ <FormLabel>Sidebar Width</FormLabel>+ <FormControl render={<Slider defaultValue={[30]} />} />+ <FormMessage errors={["Choose a valid width"]} />+ </FormItem>,+ );+ const input = document.querySelector('input[type="range"]');+ const message = screen.getByText("Choose a valid width").closest('[data-slot="form-message"]');+ expect(input).toHaveAttribute("aria-invalid", "true");+ expect(message?.id).toBeTruthy();+ expect(input?.getAttribute("aria-describedby")).toContain(message?.id);+ });+it("includes message in aria-describedby when hasError=true", () => {render(<FormItem hasError>diff --git a/tests/e2e/specs/builder-photo-defaults.spec.ts b/tests/e2e/specs/builder-photo-defaults.spec.tsindex 230464138..00b5136ee 100644--- a/tests/e2e/specs/builder-photo-defaults.spec.ts+++ b/tests/e2e/specs/builder-photo-defaults.spec.ts@@ -124,3 +124,43 @@ for (const width of [1440, 390]) {expect(overflow).toBe(false);});}++for (const layout of ["empty", "explicit"] as const) {+ test(`L3-15 JSON import recovers missing sections and preserves ${layout} layout choices`, async ({+ authPage: page,+ }) => {+ const source = await create(page, "Fictional import source", true);+ const original = await read(page, source);+ const data = structuredClone(original.data);+ data.basics.name = "Fictional imported narrative";+ data.metadata.layout.pages =+ layout === "empty" ? [] : [{ fullWidth: false, main: ["education"], sidebar: ["skills"] }];+ await page.goto("/dashboard");+ await page.getByRole("button", { name: "New", exact: true }).click();+ await page+ .getByRole("dialog", { name: "New", exact: true })+ .getByLabel("Choose a file to import")+ .setInputFiles({+ name: "fictional.json",+ mimeType: "application/json",+ buffer: Buffer.from(JSON.stringify(data)),+ });+ await page.getByRole("button", { name: "Open in editor", exact: true }).click();+ await page.waitForURL(/\/builder\/[^/]+$/);+ const id = new URL(page.url()).pathname.split("/").at(-1);+ if (!id) throw new Error("Missing imported resume");+ expect(id).not.toBe(source);+ const imported = await read(page, id);+ expect(imported.data.basics.name).toBe(data.basics.name);+ const first = imported.data.metadata.layout.pages[0];+ if (layout === "empty") expect(first.main.slice(0, 3)).toEqual(["summary", "experience", "education"]);+ else {+ expect(first.main[0]).toBe("education");+ expect(first.sidebar).toEqual(["skills"]);+ }+ expect(first.main.indexOf("profiles")).toBeGreaterThan(first.main.indexOf("experience"));+ for (const section of ["profiles", "experience", "education"])+ expect(imported.data.sections[section].items).toEqual(data.sections[section].items);+ expect((await read(page, source)).data).toEqual(original.data);+ });+}diff --git a/tooling/recovery/compare-resume.test.ts b/tooling/recovery/compare-resume.test.tsindex 0f7fc8a4a..e0bb84ae7 100644--- a/tooling/recovery/compare-resume.test.ts+++ b/tooling/recovery/compare-resume.test.ts@@ -19,6 +19,14 @@ type RecoveryRequest = {function resumeWithName(name: string) {const resume = structuredClone(defaultResumeData);+ // Manifest hashes cover the full snapshot; retain the hand-checked historical layout.+ resume.metadata.layout.pages = [+ {+ fullWidth: false,+ main: ["summary", "profiles", "experience", "education", "projects", "volunteer", "references"],+ sidebar: ["skills", "certifications", "awards", "languages", "interests", "publications"],+ },+ ];resume.basics.name = name;return resume;}