-
Notifications
You must be signed in to change notification settings - Fork 11.6k
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
DeleteDashboard: Redirect to home after deleting a dashboard #78918
Conversation
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.
I've tested it and works as expected. Left some comments.
Fixed, sorry |
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.
LGTM! Shouldn't be backported since it is a regression?
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.
Works as expected, nice!
Did you manage to figure out when/what introduced this regression? Also, I think this may deserve a backport to 10.2.x
Sorry, I got confused with the backport policy vs unscheduled releases. Marked as backport. @dprokop, it was caused because the hiddenModal function was hiding the modal before the modal re-renders since it is upper in the shadow dom hierarchy. So the hook was not triggering the callbacks under When this changes, I don't know. The code from our side hasn't been modified in 2 years. My only guess is they fixed something in the execution order of the useAsyncFn. |
(cherry picked from commit 8d7314b)
Fixes #78810
Diagnosis
The
useDeleteDashboard
was listening to when the result was present in thestate.value
fromuseAsyncFn
giving a cb to be calledonDeleteDashboard
. The callback returned byuseAsyncFn
is used inside anotheruseAsyncFn
that hides the modal once theonDeleteDashboard
is resolved.Because
onDeleteDashboard
is resolved before the next re-render is triggered, the useEffect declared inuseDeleteDashboard
is never called, so the variables and the replace is never invoked.Solution
I just simplified this piece of code, since the custom hook
useDeleteDashboard
is never used. I approached moving everything into a single async callback called when the user clicks confirm. I also removed the duplicated notification to show only one since it did not add much value.