Skip to content

Conversation

karlocehulic19
Copy link
Contributor

Description

Fixes unnecessary refetch of workflow after deletion in the settings menu by removing the second useProject hook call. It also handles deleting the last workflow project edge case.

Fixes #3111
Fixes #2762

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Manually test with React Query devtools

Checklist:

  • [ + ] My code follows the style guidelines of this project
  • [ + ] I have performed a self-review of my own code
  • [ + ] I have commented my code, particularly in hard-to-understand areas
  • [ + ] I have made corresponding changes to the documentation
  • [ + ] My changes generate no new warnings
  • [ + ] I have added tests that prove my fix is effective or that my feature works (there were no prior tests, if needed, I could add tests
  • [ + ] New and existing unit tests pass locally with my changes

I am sending the master because development has been deleted

@karlocehulic19
Copy link
Contributor Author

@kresimir-coko, could you review this PR? I am not sure why CI build check fails. I ran all Client Development tasks.

@kresimir-coko
Copy link
Collaborator

@karlocehulic19 with your changes we get a duplicate request to the project workflows endpoint, the deletion doesn't trigger the bad request anymore which is good, but we don't want the duplicate request either.

Here's an example of the duplicated request: http://127.0.0.1:5173/api/automation/internal/projects/1051/workflows

image

@karlocehulic19
Copy link
Contributor Author

@kresimir-coko, I belive I fixed the issue now, here is the video of network requests...
Screencast from 07.10.2025 15:17:59.webm

});

navigate(`/automation/projects/${projectId}/project-workflows/${firstRemainingWorkflowId}?${searchParams}`);
// exact here prevents double fetchs of project
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove comment

Comment on lines 125 to 129
const baseUrl = '/automation/projects';
const firstRemainingWorkflowUrlSuffix = firstRemainingWorkflowId
? `/${projectId}/project-workflows/${firstRemainingWorkflowId}?${searchParams}`
: '';
navigate(baseUrl + firstRemainingWorkflowUrlSuffix);
Copy link
Collaborator

Choose a reason for hiding this comment

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

we want an empty line between variable declaration and its usage.

i would also like it if you rewrote the firstRemainingWorkflowUrlSuffix so that it's an empty string by default, and if firstRemainingWorkflowId exists, change its value to the complicated string...

the pattern is something like this:

let firstRemainingWorkflowUrlSuffix = '';

if (foo) {
  firstRemainingWorkflowUrlSuffix = ...
}

otherwise, great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug]: Redirects don't happen after workflow deletion [bug]: Exception Thrown When Deleting Workflow
2 participants