Skip to content

Commit

Permalink
Merge pull request #234 from uselagoon/activestandby-navigation
Browse files Browse the repository at this point in the history
fix early nav causing NS_BINDING_ABORTED
  • Loading branch information
tobybellwood authored Apr 1, 2024
2 parents 3368759 + 31e7195 commit 0fd26fe
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 0fd26fe

Please sign in to comment.