fix: keep selected map area after publish

This commit is contained in:
Nico 2026-06-14 23:16:29 -07:00
parent 4290b5bb50
commit 66d217dfc0
2 changed files with 4 additions and 1 deletions

View File

@ -121,7 +121,7 @@ export default function useLocationMapDraftActions({
const response = await publishLocationMapDraft(activeHouseholdId, locationId);
if (!isCurrentScope()) return;
applyDraftResponse(response, "view", false);
applyDraftResponse(response, "view", false, { preserveSelectedIndex: selectedObjectIndex });
toast.success(
"Published map",
hasUnsavedChanges

View File

@ -2795,6 +2795,9 @@ test("admin publish saves pending map edits before publishing", async ({ page })
await expect(page.locator(".location-map-status")).toHaveText("Published");
await expect(page.getByRole("button", { name: "Map area Quick Publish Bakery" })).toBeVisible();
await expect(page.getByRole("button", { name: "Map area Live Bakery" })).toHaveCount(0);
await expect(page.locator(".location-map-object.is-selected")).toHaveAttribute("data-object-key", "1450");
await expect(page.locator(".location-map-sheet-header strong")).toHaveText("Quick Publish Bakery");
await expect(page.getByRole("button", { name: "Close selected map area" })).toBeVisible();
});
test("admin publish failure keeps successfully saved pending edits", async ({ page }) => {