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 add to dashboard after saving (with unit tests) #9072

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

tungsheng
Copy link
Contributor

Description

When creating a new visualization from a dashboard, and saving it with the "Add to Dashboards after saving" toggle checked, adding the newly saved visualization to the dashboard can fail. This is easily reproducible when storeInSessionStorage is enabled.

The way it is supposed to work is that the scopedHistory receives the ID of the newly create visualization in the current location state, and the dashboard container uses that to add the visualization. However, when the dashboard application state is created, it can update the URL at startup, which causes the location state to be lost. This fix preserves the current scopedHistory location state across that URL update.

original PR:

Issues Resolved

fixes:

Screenshot

N/A

Testing the changes

  1. Enable storeInSessionStorage
  2. Go to an existing dashboard and click Edit
  3. Click Create New
  4. Pick a visualization, make whatever changes are desired, then click Save
  5. Ensure "Add to Dashboards after saving" is enabled in the modal, then click Save and Return
  6. The new visualization should be added to the dashboard. This would fail before this change.

Changelog

  • fix: Preserve location state at dashboard app startup to fix adding a new visualization

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Copy link

codecov bot commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 60.85%. Comparing base (c61c7cd) to head (0e00abe).

Files with missing lines Patch % Lines
...c/application/utils/create_dashboard_app_state.tsx 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9072   +/-   ##
=======================================
  Coverage   60.85%   60.85%           
=======================================
  Files        3808     3808           
  Lines       91159    91164    +5     
  Branches    14393    14394    +1     
=======================================
+ Hits        55478    55482    +4     
  Misses      32139    32139           
- Partials     3542     3543    +1     
Flag Coverage Δ
Linux_1 28.99% <0.00%> (-0.01%) ⬇️
Linux_2 56.38% <ø> (ø)
Linux_3 37.93% <85.71%> (+<0.01%) ⬆️
Linux_4 29.01% <0.00%> (-0.01%) ⬇️
Windows_1 29.00% <0.00%> (-0.01%) ⬇️
Windows_2 56.34% <ø> (ø)
Windows_3 37.94% <85.71%> (+<0.01%) ⬆️
Windows_4 29.01% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tungsheng
Copy link
Contributor Author

tungsheng commented Dec 19, 2024

@ananzh @abbyhu2000 This PR should be ready for review. I am seeing some test failure and security check failure. Please advise how to proceed from here. Thank you for your help!!
cc @sulabhjain-dev

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.

2 participants