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

LibraryPanels: Don't include ScopedVars with persisted model #67843

Merged
merged 2 commits into from
May 24, 2023

Conversation

kaydelaney
Copy link
Contributor

Removes ScopedVars from library panel before saving.
Unfortunately this highlights another issue in that repeats are processed before library panels are resolved, so if a library panel is repeated by a variable, that variable's value needs to be refreshed or changed for repeats to be processed.
I think it's possible this is a regression introduced during the library panel frontend move, but I'd have to investigate.

Closes #65518

Note: I've marked this as a breaking change since I guess it's possible someone somewhere depended on this behavior.

@kaydelaney kaydelaney added this to the 10.0.x milestone May 4, 2023
@kaydelaney kaydelaney requested a review from a team as a code owner May 4, 2023 14:00
@kaydelaney kaydelaney self-assigned this May 4, 2023
@kaydelaney kaydelaney requested review from tskarhed, eledobleefe, a team, axelavargas, polibb and torkelo and removed request for a team May 4, 2023 14:00
@ivanortegaalba ivanortegaalba self-requested a review May 9, 2023 13:24
@ivanortegaalba
Copy link
Contributor

@dprokop suggested adding a release note if we're potentially breaking the behavior of the app. Double checking if this is a real breaking change.

@polibb
Copy link
Contributor

polibb commented May 11, 2023

I played around with both cases: the bug and the solution. It seems to me that we'd be introducing a bug in place of another bug. Now instead of having this problem:

Screen.Recording.2023-05-11.at.10.20.01.mov

We'd have this problem:

Screen.Recording.2023-05-11.at.10.17.08.mov

I don't think it's that much better.

@kaydelaney
Copy link
Contributor Author

@polibb How about with the last commit?

@@ -64,7 +64,7 @@ export async function getLibraryPanel(uid: string, isHandled = false): Promise<L
schemaVersion: 35, // should be saved in the library panel
panels: [result.model],
});
const model = dash.panels[0].getSaveModel(); // migrated panel
const { scopedVars, ...model } = dash.panels[0].getSaveModel(); // migrated panel
Copy link
Member

Choose a reason for hiding this comment

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

getSaveModel should never include scopedVars, it should be safe to add scopedVars to non persisted props in PanelModel?

It is cleaned as part of DashboardModel.getPanelSaveModels but maybe it's better to do that in PanelModel ?

Copy link
Contributor

@polibb polibb left a comment

Choose a reason for hiding this comment

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

works as expected! 😊 🙌
not going over @torkelo's comment, but approving the manual testing and additions on loadLibraryPanelAndUpdate

@ivanortegaalba ivanortegaalba added no-changelog Skip including change in changelog/release notes and removed breaking change Relevant for changelog generation labels May 24, 2023
@kaydelaney kaydelaney merged commit 4d74f75 into main May 24, 2023
@kaydelaney kaydelaney deleted the issue-65518 branch May 24, 2023 13:26
grafanabot pushed a commit that referenced this pull request May 24, 2023
@zerok zerok modified the milestones: 10.0.x, 10.0.0-preview, 10.1.x May 31, 2023
@ricky-undeadcoders ricky-undeadcoders modified the milestones: 10.1.x, 10.1.0 Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants