From 50bd35ee891eccf454c6ba9e7d22bfff8b05ef4e Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Wed, 29 May 2024 12:31:32 -0700 Subject: [PATCH 1/4] Update Dashboard.js --- src/electron/frontend/core/components/Dashboard.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/electron/frontend/core/components/Dashboard.js b/src/electron/frontend/core/components/Dashboard.js index 0b3b96ca5..2d6ad5e33 100644 --- a/src/electron/frontend/core/components/Dashboard.js +++ b/src/electron/frontend/core/components/Dashboard.js @@ -268,7 +268,15 @@ export class Dashboard extends LitElement { if (previous && previous.info.previous === this.page) await this.page.onTransition(-1); else await this.page.onTransition(1); } - }); + }).catch((e) => { + const previousId = previous?.info?.id + if (previousId) { + page.onTransition(previousId); // Revert back to previous page + page.notify(`

Previous page loaded after error occured

${e}`, "error"); + } + + else reloadPageToHome(); + }) } // Populate the sections tracked for this page by using the global state as a model From 17a1400cd0ba039687710d68583383c57b16e1e4 Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Wed, 29 May 2024 12:33:14 -0700 Subject: [PATCH 2/4] Update Dashboard.js --- src/electron/frontend/core/components/Dashboard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/electron/frontend/core/components/Dashboard.js b/src/electron/frontend/core/components/Dashboard.js index 2d6ad5e33..032caca9c 100644 --- a/src/electron/frontend/core/components/Dashboard.js +++ b/src/electron/frontend/core/components/Dashboard.js @@ -272,7 +272,7 @@ export class Dashboard extends LitElement { const previousId = previous?.info?.id if (previousId) { page.onTransition(previousId); // Revert back to previous page - page.notify(`

Previous page loaded after error occured

${e}`, "error"); + page.notify(`

Fallback to previous page after error occured

${e}`, "error"); } else reloadPageToHome(); From 5059fcf2ec00ffb5401025c4f87e158fee63c1ee Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Wed, 29 May 2024 15:33:58 -0400 Subject: [PATCH 3/4] Update src/electron/frontend/core/components/Dashboard.js --- src/electron/frontend/core/components/Dashboard.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/electron/frontend/core/components/Dashboard.js b/src/electron/frontend/core/components/Dashboard.js index 032caca9c..90e15eaef 100644 --- a/src/electron/frontend/core/components/Dashboard.js +++ b/src/electron/frontend/core/components/Dashboard.js @@ -272,7 +272,8 @@ export class Dashboard extends LitElement { const previousId = previous?.info?.id if (previousId) { page.onTransition(previousId); // Revert back to previous page - page.notify(`

Fallback to previous page after error occured

${e}`, "error"); + page.notify(`

Fallback to previous page after error occurred

${e}`, "error"); + } else reloadPageToHome(); From 35f1f4ce137d372cc9fad711f3b31c31e5c976ce Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 29 May 2024 19:35:50 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../frontend/core/components/Dashboard.js | 73 ++++++++++--------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/src/electron/frontend/core/components/Dashboard.js b/src/electron/frontend/core/components/Dashboard.js index 90e15eaef..6ed8f3d7b 100644 --- a/src/electron/frontend/core/components/Dashboard.js +++ b/src/electron/frontend/core/components/Dashboard.js @@ -243,41 +243,44 @@ export class Dashboard extends LitElement { this.page.set(toPass, false); - this.page.checkSyncState().then(async () => { - const projectName = info.globalState?.project?.name; - - this.subSidebar.header = projectName - ? `

${projectName}

Conversion Pipeline` - : projectName; - - this.updateSections({ sidebar: false, main: true }); - - if (this.#transitionPromise.value) this.#transitionPromise.trigger(page); // This ensures calls to page.to() can be properly awaited until the next page is ready - - const { skipped } = this.subSidebar.sections[info.section]?.pages?.[info.id] ?? {}; - - if (skipped) { - if (isStorybook) return; // Do not skip on storybook - - // Run skip functions - Object.entries(page.workflow).forEach(([key, state]) => { - if (typeof state.skip === "function") state.skip(); - }); - - // Skip right over the page if configured as such - if (previous && previous.info.previous === this.page) await this.page.onTransition(-1); - else await this.page.onTransition(1); - } - }).catch((e) => { - const previousId = previous?.info?.id - if (previousId) { - page.onTransition(previousId); // Revert back to previous page - page.notify(`

Fallback to previous page after error occurred

${e}`, "error"); - - } - - else reloadPageToHome(); - }) + this.page + .checkSyncState() + .then(async () => { + const projectName = info.globalState?.project?.name; + + this.subSidebar.header = projectName + ? `

${projectName}

Conversion Pipeline` + : projectName; + + this.updateSections({ sidebar: false, main: true }); + + if (this.#transitionPromise.value) this.#transitionPromise.trigger(page); // This ensures calls to page.to() can be properly awaited until the next page is ready + + const { skipped } = this.subSidebar.sections[info.section]?.pages?.[info.id] ?? {}; + + if (skipped) { + if (isStorybook) return; // Do not skip on storybook + + // Run skip functions + Object.entries(page.workflow).forEach(([key, state]) => { + if (typeof state.skip === "function") state.skip(); + }); + + // Skip right over the page if configured as such + if (previous && previous.info.previous === this.page) await this.page.onTransition(-1); + else await this.page.onTransition(1); + } + }) + .catch((e) => { + const previousId = previous?.info?.id; + if (previousId) { + page.onTransition(previousId); // Revert back to previous page + page.notify( + `

Fallback to previous page after error occurred

${e}`, + "error" + ); + } else reloadPageToHome(); + }); } // Populate the sections tracked for this page by using the global state as a model