Skip to content

Commit

Permalink
fix early nav causing NS_BINDING_ABORTED
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveDarsa committed Mar 27, 2024
1 parent 3368759 commit 31e7195
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/components/Environment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ const Environment = ({ environment }) => {
}`
: '';

const navigateToTasks = () => {
const projectName = environment.project.name;

const taskNavObject = {
urlObject: {
pathname: '/tasks',
query: { openshiftProjectName: environment.openshiftProjectName },
},
asPath: `/projects/${projectName}/${environment.openshiftProjectName}/tasks`,
};

Router.push(taskNavObject.urlObject, taskNavObject.asPath);
};
return (
<StyledEnvironmentDetails className="details" data-cy="env-details">
<div className="field-wrapper environmentType">
Expand Down Expand Up @@ -150,7 +163,7 @@ const Environment = ({ environment }) => {
environment.project.standbyProductionEnvironment &&
environment.environmentType == 'production' &&
environment.project.standbyProductionEnvironment == environment.name && (
<Mutation mutation={SwitchActiveStandbyMutation}>
<Mutation mutation={SwitchActiveStandbyMutation} onCompleted={navigateToTasks}>
{(switchActiveStandby, { loading, called, error, data }) => {
const switchActiveBranch = () => {
const input = {
Expand All @@ -160,7 +173,6 @@ const Environment = ({ environment }) => {
};

switchActiveStandby({ variables: { input } });
Router.push(`/projects/${environment.project.name}/${environment.openshiftProjectName}/tasks`);
};

if (!error && called && loading) {
Expand Down

0 comments on commit 31e7195

Please sign in to comment.