Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the standalone instant launch page show errors immediately #610

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use WrappedErrorHandler instead
ianmcorvidae committed Dec 5, 2024

Verified

This commit was signed with the committer’s verified signature.
ianmcorvidae Ian McEwen
commit a3c80926d942db9a69e05fbed4f1e11ca4a0acb4
27 changes: 3 additions & 24 deletions src/components/instantlaunches/launch/index.js
Original file line number Diff line number Diff line change
@@ -3,12 +3,10 @@
*
* The component that launches a provided instant launch, immediately.
*/
import React, { useState, useEffect } from "react";
import React, { useState } from "react";

import { useQuery } from "react-query";

import { useRouter } from "next/router";

import {
GET_INSTANT_LAUNCH_FULL_KEY,
getFullInstantLaunch,
@@ -28,7 +26,7 @@ import InstantLaunchButtonWrapper from "components/instantlaunches/InstantLaunch
import withErrorAnnouncer from "components/error/withErrorAnnouncer";
import LoadingAnimation from "components/vice/loading/LoadingAnimation";

import DEErrorDialog from "components/error/DEErrorDialog";
import WrappedErrorHandler from "components/error/WrappedErrorHandler";

const InstantLaunchStandalone = (props) => {
const {
@@ -42,10 +40,7 @@ const InstantLaunchStandalone = (props) => {
!!config?.subscriptions?.enforce
);
const [resource, setResource] = useState(null);
const [errDialogOpen, setErrDialogOpen] = useState(false);
const [dialogError, setDialogError] = useState(null);

const router = useRouter();
const { t } = useTranslation(["instantlaunches", "common"]);

const { data, status, error } = useQuery(
@@ -86,26 +81,10 @@ const InstantLaunchStandalone = (props) => {
isFetchingUsageSummary,
]);

useEffect(() => {
if (error || resourceError) {
setDialogError(error || resourceError);
setErrDialogOpen(true);
}
}, [error, resourceError, setErrDialogOpen, setDialogError]);

if (isLoading) {
return <LoadingAnimation />;
} else if (error || resourceError) {
return (
<DEErrorDialog
open={errDialogOpen}
errorObject={dialogError}
handleClose={() => {
setErrDialogOpen(false);
router.push("/");
}}
/>
);
return <WrappedErrorHandler errorObject={error || resourceError} />;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also have a baseId, though I don't see one already setup for this button wrapper 🤔
I guess ids.BASE should work for now 🤷

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I haven't been sure what to do for the debug IDs. I figure we don't really use them anymore really anyway, but I'll add... something, at least.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, they were mainly for QA tests, and we haven't added any new RobotFramework/Selenium tests in a while, but all other uses of this component have a baseId, so I figure why not keep it consistent for now 🤷

} else {
return (
<InstantLaunchButtonWrapper