Skip to content

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!

fix: retain photo URLs saved during uploads

Amruth Pillaiee735ac370e3
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.tsx
index b2d41ba5e..e161fb240 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
@@ -195,7 +195,7 @@ it("opens the file picker directly from Add before showing photo settings", () =
client.clear();
});
-it.each(["current", "resume", "locked", "account"])(
+it.each(["current", "resume", "locked", "account", "url"])(
"an upload only updates its current owner URL (%s)",
async (scenario) => {
let finish: (value: { url: string }) => void = () => {};
@@ -230,6 +230,10 @@ it.each(["current", "resume", "locked", "account"])(
invalidateAccountScope();
useResumeStore.getState().initialize({ ...initial, data: structuredClone(initial.data) });
}
+ if (scenario === "url")
+ useResumeStore.getState().updateResumeData((draft) => {
+ draft.picture.url = "/api/uploads/owner/pictures/manual.png";
+ });
if (scenario === "current")
useResumeStore.getState().updateResumeData((draft) => {
draft.picture.size = 144;
diff --git a/apps/web/src/features/resume/editor/write/picture-settings.tsx b/apps/web/src/features/resume/editor/write/picture-settings.tsx
index d24cd1aeb..1f785be2c 100644
--- a/apps/web/src/features/resume/editor/write/picture-settings.tsx
+++ b/apps/web/src/features/resume/editor/write/picture-settings.tsx
@@ -712,12 +712,13 @@ export function PictureSettings({ locked }: PictureSettingsProps) {
toast.add({ type: "error", description: t`This photo is larger than 10 MB. Use Crop and upload to shrink it.` });
return;
}
+ const originalUrl = useResumeStore.getState().resume?.data.picture.url;
const toastId = toast.add({ type: "loading", description: t`Uploading photo…` });
uploadFile(file, {
onSuccess: ({ url }) => {
toast.close(toastId);
- if (!current()) return;
+ if (!current() || useResumeStore.getState().resume?.data.picture.url !== originalUrl) return;
form.setFieldValue("url", url);
updateResumeData(
(draft) => {
diff --git a/docs/guides/creating-your-first-resume.mdx b/docs/guides/creating-your-first-resume.mdx
index 3cfd7b194..e5c442f82 100644
--- a/docs/guides/creating-your-first-resume.mdx
+++ b/docs/guides/creating-your-first-resume.mdx
@@ -71,7 +71,7 @@ The editor opens in **Write** mode. **Full name** starts with your account name;
## Add your first section
-Below your details, under **Sections · print order**, Reactive Resume suggests the sections most resumes have: Experience, Education, Projects, Skills and Summary. No work experience yet? Start with Education or Projects: when Experience and Education sit in the main column of the same page, they print in the order you start them. A blank resume also starts with your account's name and email filled in (a guest's has the name only). New resumes start with Summary, Experience, Education and Projects in that order; Profiles sits after the other main-column sections. Existing resumes and imported layouts keep their saved order.
+Below your details, under **Sections · print order**, Reactive Resume suggests the sections most resumes have: Experience, Education, Projects, Skills and Summary. No work experience yet? Start with Education or Projects: when Experience and Education sit in the main column of the same page, they print in the order you start them. A blank resume also starts with your account's name and email filled in (a guest's has the name only). Blank resumes start with Summary, Experience, Education and Projects in that order; Profiles sits after the other main-column sections. Sample resumes keep their own order. Existing resumes and imported layouts keep their saved order.
<Frame caption="Starter sections on a new resume">
<img
diff --git a/tests/e2e/specs/builder-photo-defaults.spec.ts b/tests/e2e/specs/builder-photo-defaults.spec.ts
index 00b5136ee..85b362b34 100644
--- a/tests/e2e/specs/builder-photo-defaults.spec.ts
+++ b/tests/e2e/specs/builder-photo-defaults.spec.ts
@@ -11,11 +11,22 @@ async function read(page: Page, id: string) {
expect(r.ok()).toBe(true);
return r.json();
}
+
+async function downloadPdfText(page: Page) {
+ const pending = page.waitForEvent("download");
+ await page.getByRole("button", { name: "Download PDF", exact: true }).click();
+ const file = await pending;
+ expect(await file.failure()).toBeNull();
+ const path = await file.path();
+ if (!path) throw Error("missing PDF");
+ return execFileSync("pdftotext", [path, "-"], { encoding: "utf8" }).toLowerCase();
+}
test("L3-15 new default PDF keeps career narrative first and all links, preserving explicit layouts", async ({
authPage: page,
}) => {
const id = await create(page, "Fictional professional order");
const sample = await read(page, await create(page, "Fictional source", true));
+ expect(sample.data.metadata.layout.pages[0].main.slice(0, 3)).toEqual(["summary", "education", "experience"]);
const saved = await read(page, id);
const data = saved.data;
expect(data.metadata.layout.pages[0].main.slice(0, 3)).toEqual(["summary", "experience", "education"]);
@@ -42,13 +53,7 @@ test("L3-15 new default PDF keeps career narrative first and all links, preservi
});
expect(patch.ok()).toBe(true);
await page.goto(`/builder/${id}`);
- const pending = page.waitForEvent("download");
- await page.getByRole("button", { name: "Download PDF", exact: true }).click();
- const file = await pending;
- expect(await file.failure()).toBeNull();
- const path = await file.path();
- if (!path) throw Error("missing PDF");
- const text = execFileSync("pdftotext", [path, "-"], { encoding: "utf8" }).toLowerCase();
+ const text = await downloadPdfText(page);
for (const title of [
"Fictional professional summary.",
"Fictional experience",
@@ -56,6 +61,7 @@ test("L3-15 new default PDF keeps career narrative first and all links, preservi
"Fictional links",
])
expect(text).toContain(title.toLowerCase());
+ expect(text).toContain(sample.data.sections.profiles.items[0].username.toLowerCase());
expect(text.indexOf("fictional professional summary.")).toBeLessThan(text.indexOf("fictional experience"));
expect(text.indexOf("fictional experience")).toBeLessThan(text.indexOf("fictional education"));
expect(text.indexOf("fictional education")).toBeLessThan(text.indexOf("fictional links"));
@@ -66,6 +72,19 @@ test("L3-15 new default PDF keeps career narrative first and all links, preservi
expect(changed.ok()).toBe(true);
await page.reload();
expect((await read(page, id)).data.metadata.layout.pages[0].main).toEqual(explicit);
+ const explicitText = await downloadPdfText(page);
+ for (const title of [
+ "fictional links",
+ "fictional education",
+ "fictional experience",
+ "fictional professional summary.",
+ ])
+ expect(explicitText).toContain(title);
+ expect(explicitText.indexOf("fictional links")).toBeLessThan(explicitText.indexOf("fictional education"));
+ expect(explicitText.indexOf("fictional education")).toBeLessThan(explicitText.indexOf("fictional experience"));
+ expect(explicitText.indexOf("fictional experience")).toBeLessThan(
+ explicitText.indexOf("fictional professional summary."),
+ );
});
test("L3-30 Add chooses file, crop cancel keeps document, upload enables appearance controls", async ({
authPage: page,