-
Notifications
You must be signed in to change notification settings - Fork 118
3111 - Redirects don't happen after workflow deletion #3159
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
Changes from 4 commits
bb93d38
54a35ac
89dacf4
3047e32
bc27daf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,6 @@ import { | |
| useGetProjectGitConfigurationQuery, | ||
| } from '@/ee/shared/mutations/automation/projectGit.queries'; | ||
| import {useToast} from '@/hooks/use-toast'; | ||
| import {useProject} from '@/pages/automation/project/hooks/useProject'; | ||
| import {Project, Workflow} from '@/shared/middleware/automation/configuration'; | ||
| import {useDeleteProjectMutation, useDuplicateProjectMutation} from '@/shared/mutations/automation/projects.mutations'; | ||
| import { | ||
|
|
@@ -26,7 +25,7 @@ import {useNavigate, useSearchParams} from 'react-router-dom'; | |
| export const useSettingsMenu = ({project, workflow}: {project: Project; workflow: Workflow}) => { | ||
| const {data: projectGitConfiguration} = useGetProjectGitConfigurationQuery(project.id!); | ||
|
|
||
| const {projectId} = useProject(); | ||
| const projectId = project.id; | ||
|
|
||
| const navigate = useNavigate(); | ||
| const [searchParams] = useSearchParams(); | ||
|
|
@@ -103,7 +102,7 @@ export const useSettingsMenu = ({project, workflow}: {project: Project; workflow | |
| (projectWorkflowId) => projectWorkflowId !== deletedWorkflowId | ||
| ); | ||
|
|
||
| if (!projectId || !firstRemainingWorkflowId || !deletedWorkflowId) { | ||
| if (!projectId || !deletedWorkflowId) { | ||
| return; | ||
| } | ||
|
|
||
|
|
@@ -117,7 +116,17 @@ export const useSettingsMenu = ({project, workflow}: {project: Project; workflow | |
| queryKey: ProjectWorkflowKeys.projectWorkflows(projectId), | ||
| }); | ||
|
|
||
| navigate(`/automation/projects/${projectId}/project-workflows/${firstRemainingWorkflowId}?${searchParams}`); | ||
| // exact here prevents double fetchs of project | ||
| queryClient.invalidateQueries({ | ||
| exact: true, | ||
| queryKey: ProjectKeys.project(projectId), | ||
| }); | ||
|
|
||
| const baseUrl = '/automation/projects'; | ||
| const firstRemainingWorkflowUrlSuffix = firstRemainingWorkflowId | ||
| ? `/${projectId}/project-workflows/${firstRemainingWorkflowId}?${searchParams}` | ||
| : ''; | ||
| navigate(baseUrl + firstRemainingWorkflowUrlSuffix); | ||
|
Comment on lines
124
to
131
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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! |
||
| }, | ||
| }); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment