Skip to content
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

[v10.2.x] DeleteDashboard: Redirect to home after deleting a dashboard #78936

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

grafana-delivery-bot[bot]
Copy link
Contributor

Backport 8d7314b from #78918


Fixes #78810

Diagnosis
The useDeleteDashboard was listening to when the result was present in the state.value from useAsyncFn giving a cb to be called onDeleteDashboard. The callback returned by useAsyncFn is used inside another useAsyncFn that hides the modal once the onDeleteDashboard is resolved.

Because onDeleteDashboard is resolved before the next re-render is triggered, the useEffect declared in useDeleteDashboard 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.

@ivanortegaalba ivanortegaalba merged commit 584800d into v10.2.x Dec 1, 2023
21 checks passed
@ivanortegaalba ivanortegaalba deleted the backport-78918-to-v10.2.x branch December 1, 2023 10:08
@aangelisc aangelisc modified the milestones: 10.2.x, 10.2.3 Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants