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] Dashboards: Fix issue causing crashes when saving new dashboard #77641

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

grafana-delivery-bot[bot]
Copy link
Contributor

Backport c98add6 from #77620


Maybe "avoids issue" is a better title. The underlying issue is here:

useEffect(() => {
if (error.data && proxyHandlesError(error.data.status)) {
error.isHandled = true;
}
}, [error]);

Specifically line 34 where error.isHandled is set to true.

It seems like what happens is:

  1. User creates new dashboard
  2. User adds panel, edit view is opened
  3. User hits save, drawer opens, then confirms save
  4. POST request is made with dashboard json, is saved successfully
  5. After save, tries to exit panel edit view
  6. DashboardPrompt onHistoryBlock function is called.
  7. hasChanges(dashboard, original) is called, but at this stage original still has version 0, while dashboard has version 1. Note that there is code in DashboardPrompt to update original when a DashboardSavedEvent is emitted, but I guess hasChanges gets executed first
  8. Unsaved changes prompt appears, user hits save
  9. POST request is made with the same dashboard json, error gets returned since it already exists
  10. Line 34 in SaveDashboardErrorProxy occurs, causing the crash.

So with this PR the issue is sort of avoided by saying "ignore changes if all we're changing is a dashboard that hasn't been saved yet", but I guess a "real" fix would figure out how to update original in DashboardPrompt before it looks for unsaved changes.

Closes #77593

@dprokop dprokop enabled auto-merge (squash) November 13, 2023 15:10
@dprokop dprokop merged commit 9e8afef into v10.2.x Nov 13, 2023
11 checks passed
@dprokop dprokop deleted the backport-77620-to-v10.2.x branch November 13, 2023 15:19
@ifrost ifrost modified the milestones: 10.2.x, 10.2.2, 10.2.1 Nov 20, 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

3 participants