diff --git a/CHANGES.md b/CHANGES.md index bdc1b9799..4cc903022 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -62,6 +62,7 @@ is a number of cores) - Added upload svg with images method [#5489](https://github.com/penpot/penpot/issues/5489) - Fix problem with root frame parent reference [Taiga #9437](https://tree.taiga.io/project/penpot/issue/9437) - Fix change flex direction using plugins API [Taiga #9407](https://tree.taiga.io/project/penpot/issue/9407) +- Fix problem opening url when page-id didn't exist [Taiga #10157](https://tree.taiga.io/project/penpot/issue/10157) - Fix problem with onboarding to a team [Taiga #10143](https://tree.taiga.io/project/penpot/issue/10143) - Fix problem with grid layout crashing [Taiga #10127](https://tree.taiga.io/project/penpot/issue/10127) diff --git a/frontend/playwright/ui/specs/workspace.spec.js b/frontend/playwright/ui/specs/workspace.spec.js index 474ceb41f..34fa61bbf 100644 --- a/frontend/playwright/ui/specs/workspace.spec.js +++ b/frontend/playwright/ui/specs/workspace.spec.js @@ -15,6 +15,17 @@ test("User loads worskpace with empty file", async ({ page }) => { await expect(workspacePage.pageName).toHaveText("Page 1"); }); +test("User opens a file with a bad page id", async ({ page }) => { + const workspacePage = new WorkspacePage(page); + await workspacePage.setupEmptyFile(page); + + await workspacePage.goToWorkspace({ + pageId: "badpage", + }); + + await expect(workspacePage.pageName).toHaveText("Page 1"); +}); + test("User receives presence notifications updates in the workspace", async ({ page, }) => { diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index 0b44bceb2..ccffeef9a 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -450,10 +450,12 @@ ptk/WatchEvent (watch [_ state _] - (let [file-id (:current-file-id state)] - (rx/of (preload-data-uris page-id) - (dwth/watch-state-changes file-id page-id) - (dwl/watch-component-changes)))))) + (if (dsh/lookup-page state page-id) + (let [file-id (:current-file-id state)] + (rx/of (preload-data-uris page-id) + (dwth/watch-state-changes file-id page-id) + (dwl/watch-component-changes))) + (rx/of (dcm/go-to-workspace)))))) (defn finalize-page [page-id]