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

[DT-1137]After creating a snapshot - dataset tab appears selected even after selecting the snapshot tab #1742

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

rjohanek
Copy link
Contributor

@rjohanek rjohanek commented Jan 22, 2025

Summary:
When changing tabs is routed through the SnapshotPopup the window goes to the correct location, but the incorrect tab is selected. This allows the selected tab to be updated whenever the window is changed.

Changes:
add useEffect for selected tab dependent on current window location

Testing:
Just visually tested as in the video.

Before:
https://github.com/user-attachments/assets/c7d4dd5d-c0be-4d80-b803-cc5cfa2fe645

After:
https://github.com/user-attachments/assets/844fe0ae-4ca1-490c-a327-d53f27ad9122

@rjohanek rjohanek requested a review from a team as a code owner January 22, 2025 16:50
@rjohanek rjohanek requested review from snf2ye and fboulnois and removed request for a team January 22, 2025 16:50
Copy link

cypress bot commented Jan 22, 2025

jade-data-repo-ui    Run #3984

Run Properties:  status check passed Passed #3984  •  git commit 7127cef8a4 ℹ️: Merge 5d2cb3ca3949ae43875c5c57f9c43bbb119ce315 into d16f27098a65726b2ed404a51d47...
Project jade-data-repo-ui
Branch Review rj/dt-1137-update-tab
Run status status check passed Passed #3984
Run duration 03m 12s
Commit git commit 7127cef8a4 ℹ️: Merge 5d2cb3ca3949ae43875c5c57f9c43bbb119ce315 into d16f27098a65726b2ed404a51d47...
Committer Rachel Johanek
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 17
View all changes introduced in this branch ↗︎

Copy link
Contributor

@rushtong rushtong left a comment

Choose a reason for hiding this comment

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

👍🏽

Copy link
Member

@pshapiro4broad pshapiro4broad left a comment

Choose a reason for hiding this comment

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

Looks ok, would be nice to get rid of history.location if we can

const locationSplit = history.location.pathname.split('/');
const selectedTab = `/${locationSplit[1] || 'datasets'}`;
useEffect(() => {
const locationSplit = history.location.pathname.split('/');
Copy link
Member

Choose a reason for hiding this comment

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

Could this use location instead? Is there a difference between history.location vs location? If so, that would make it clearer why the useEffect() is needed here.

Suggested change
const locationSplit = history.location.pathname.split('/');
const locationSplit = location.pathname.split('/');

Copy link
Contributor

@fboulnois fboulnois left a comment

Choose a reason for hiding this comment

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

I agree with Phil's question, otherwise lgtm

@rjohanek rjohanek merged commit 875e519 into develop Jan 22, 2025
9 checks passed
@rjohanek rjohanek deleted the rj/dt-1137-update-tab branch January 22, 2025 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants