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

[Discover] fix: Clean up sync URL subscription in Discover plugin topNav #9316

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

Conversation

Maosaic
Copy link
Contributor

@Maosaic Maosaic commented Jan 31, 2025

Description

Properly clean up sync URL subscription in Discover plugin topNav component.

Changes this PR contains:

  1. Create useSyncQueryStateWithUrl hook which automatically cancel sync URL subscription.
  2. Invoke useSyncQueryStateWithUrl from topNav component, so the URL subscription will be properly clean up when user navigate away from Discover page.
  3. Rewrite SavedObjectSaveModal as functional component.

Issues Resolved

fixes #9309

Screenshot

Before

Screen.Recording.2025-01-29.at.2.56.41.PM.mp4

After

Screen.Recording.2025-01-31.at.10.43.38.AM.mp4

Testing the changes

Changelog

  • fix: Clean up sync URL subscription in Discover plugin topNav

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 Jan 31, 2025

Codecov Report

Attention: Patch coverage is 53.33333% with 28 lines in your changes missing coverage. Please review.

Project coverage is 61.72%. Comparing base (95cfb51) to head (9adae0f).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ects/public/save_modal/saved_object_save_modal.tsx 51.11% 16 Missing and 6 partials ⚠️
...plication/components/top_nav/get_top_nav_links.tsx 0.00% 3 Missing ⚠️
...public/query/state_sync/use_sync_state_with_url.ts 81.81% 1 Missing and 1 partial ⚠️
...lic/application/view_components/canvas/top_nav.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9316      +/-   ##
==========================================
+ Coverage   61.71%   61.72%   +0.01%     
==========================================
  Files        3816     3817       +1     
  Lines       91829    91848      +19     
  Branches    14543    14545       +2     
==========================================
+ Hits        56668    56689      +21     
+ Misses      31506    31503       -3     
- Partials     3655     3656       +1     
Flag Coverage Δ
Linux_1 28.98% <3.33%> (-0.01%) ⬇️
Linux_2 56.46% <ø> (ø)
Linux_3 39.18% <16.66%> (-0.01%) ⬇️
Linux_4 28.90% <40.00%> (-0.01%) ⬇️
Windows_1 29.01% <3.33%> (+0.01%) ⬆️
Windows_2 56.41% <ø> (ø)
Windows_3 39.19% <16.66%> (-0.01%) ⬇️
Windows_4 28.90% <40.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.

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.

[BUG] Error restoring state from URL when navigate between Discover and Dashboard
1 participant