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

fix(notebook): fix notebook plugin not loading notebook parameters when opening visualization #61

Merged
merged 1 commit into from
May 29, 2024

Conversation

Catalin-web
Copy link
Contributor

@Catalin-web Catalin-web commented May 23, 2024

Pull Request

🤨 Rationale

The notebook parameters are not loading when reopening a visualisation from notebook plugin data source.
Steps to produce:

  1. Open a Grafana dashboard which uses a python notebook as a datasource for a vizualition
  2. Open the configuration for the visualization
  3. Open the query

👩‍💻 Implementation

Use queried notebooks instead of notebooks from actual state. This is a problem because in the same function a state was both set and used. Here is a overview of how calls are made:

componentDidMount: setState, getNotebook, getNotebookMetadata (on retrieved notebook)
getNotebook: get notebook from saved state

Only after componentDidMount & getNotebook is finished the state is actually updated. So, because getNotebook actually called componentDidMount, the saved state there is actually the previous saved state, wich is null when the page loads.

This is a frequenctly bug in react. Here is a nice blog about it: link

🧪 Testing

N/A

✅ Checklist

@cameronwaterman
Copy link
Collaborator

Please review the commit message format specified in the README and update this PR title accordingly.

@cameronwaterman
Copy link
Collaborator

Could you explain your fix a little more? I understand what's happening, but it's not clear why it fixes the issue.

@Catalin-web Catalin-web changed the title [NotebookPlugin] Fix notbook plugin not loading when opening visualisation feat(notebook): fix notbook plugin not loading when opening visualisation May 27, 2024
@Catalin-web Catalin-web reopened this May 27, 2024
@Catalin-web Catalin-web changed the title feat(notebook): fix notbook plugin not loading when opening visualisation feat(notebook): fix notbook plugin not loading notebook parameters when opening visualisation May 27, 2024
@cameronwaterman cameronwaterman changed the title feat(notebook): fix notbook plugin not loading notebook parameters when opening visualisation fix(notebook): fix notebook plugin not loading notebook parameters when opening visualization May 28, 2024
@cameronwaterman
Copy link
Collaborator

Since this is a bug fix and not a feature, I updated your title to use the "fix" prefix instead of "feat".

@Catalin-web Catalin-web merged commit c81d963 into main May 29, 2024
2 checks passed
mure pushed a commit that referenced this pull request May 29, 2024
## [3.10.1](v3.10.0...v3.10.1) (2024-05-29)

### Bug Fixes

* **notebook:** fix notebook plugin not loading notebook parameters when opening visualization ([#61](#61)) ([c81d963](c81d963))
@mure
Copy link
Collaborator

mure commented May 29, 2024

🎉 This PR is included in version 3.10.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@mure mure added the released label May 29, 2024
@mure mure deleted the users/cbugnar/notebookGrafanaPluginBug branch October 3, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants