-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
jade-data-repo-ui
|
Project |
jade-data-repo-ui
|
Branch Review |
rj/dt-1137-update-tab
|
Run status |
|
Run duration | 03m 12s |
Commit |
|
Committer | Rachel Johanek |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
0
|
|
0
|
|
17
|
View all changes introduced in this branch ↗︎ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏽
There was a problem hiding this 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
src/components/common/TabWrapper.tsx
Outdated
const locationSplit = history.location.pathname.split('/'); | ||
const selectedTab = `/${locationSplit[1] || 'datasets'}`; | ||
useEffect(() => { | ||
const locationSplit = history.location.pathname.split('/'); |
There was a problem hiding this comment.
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.
const locationSplit = history.location.pathname.split('/'); | |
const locationSplit = location.pathname.split('/'); |
There was a problem hiding this 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
|
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