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 undefined tabValue (#6470) #6694

Merged

Conversation

XanderLuciano
Copy link
Contributor

#6470 Points out that the new UI nav bar does not correctly set the ;tabValue on initial page load.

This is because useParams will return the params from the route as defined in the router. Our router does not define :tabValue/* for all routes so the object returned from useParams does not have a tabValue property and is therefore undefined on initial page load.

This PR uses useMatch to create a new URL match for :tabName/* and sets the tabValue variable correctly.

The result, is a navbar that always has the correct tab shown as active.

Copy link

netlify bot commented Mar 13, 2024

Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit 1620e7e
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/65f15779fbfc8d00083500a3
😎 Deploy Preview https://deploy-preview-6694--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 86 (no change from production)
Best Practices: 100 (no change from production)
SEO: 70 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@XanderLuciano
Copy link
Contributor Author

XanderLuciano commented Mar 13, 2024

Also fixes #6471 (issue duplicating the discussion)

@SchrodingersGat SchrodingersGat added bug Identifies a bug which needs to be addressed Platform UI Related to the React based User Interface labels Mar 13, 2024
@SchrodingersGat SchrodingersGat added this to the 0.15.0 milestone Mar 13, 2024
@SchrodingersGat
Copy link
Member

@XanderLuciano nice work, seems to work pretty well :)

@SchrodingersGat SchrodingersGat enabled auto-merge (squash) March 13, 2024 07:45
@XanderLuciano
Copy link
Contributor Author

Thank you! I'm Looking forward to submitting additional contributions towards the new react UI 🥳

@SchrodingersGat SchrodingersGat merged commit 128fa95 into inventree:master Mar 13, 2024
24 checks passed
@XanderLuciano XanderLuciano deleted the fix-navbar-active-tab branch March 13, 2024 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identifies a bug which needs to be addressed Platform UI Related to the React based User Interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants