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

Fixing Header to rely on location and not parameter. #6472

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

CodingPupper3033
Copy link
Contributor

@CodingPupper3033 CodingPupper3033 commented Feb 12, 2024

Closes #6471
Fixes issue #6471

Let me check the commit test server thing to see if it's working before it's merged.

…of the parameter abValue which does not exist.
Copy link

netlify bot commented Feb 12, 2024

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

Name Link
🔨 Latest commit fa1cb1b
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/65ca2b3ed1144d000858d25e
😎 Deploy Preview https://deploy-preview-6472--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.

@CodingPupper3033
Copy link
Contributor Author

^ The commit test server thing translates to Deploy Preview. It appears to work; however, I am slightly confused as to what the Style error is telling me.

@CodingPupper3033
Copy link
Contributor Author

I see; it was telling me what to change, not what the issue was. Got it!

@matmair matmair added bug Identifies a bug which needs to be addressed Platform UI Related to the React based User Interface labels Feb 12, 2024
@matmair matmair added this to the 0.14.0 milestone Feb 12, 2024
@@ -100,12 +100,13 @@ export function Header() {

function NavTabs() {
const { classes } = InvenTreeStyle();
const { tabValue } = useParams();
const defaultTabValue = 'home';
const tabValue = useLocation().pathname.split('/')[1] || defaultTabValue;
Copy link
Member

@matmair matmair Feb 12, 2024

Choose a reason for hiding this comment

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

Not sure that is a great solution, this is indirectly hardcoded to the current schema - which might change at any point. Thoughts @wolflu05 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this would also be my first concern, as we have the feature to configure a relative path where PUI is hosted. Maybe we can use that setting to somehow strip the prefix or find a solution to only get the url from after the prefix.

And secondly it would be better to wrap the .split and parsing of the panel name into a useMemo hook, so this is in a state and does not cause a rerendering.

Copy link
Contributor Author

@CodingPupper3033 CodingPupper3033 Feb 12, 2024

Choose a reason for hiding this comment

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

I agree with your concerns, and it may not be the best idea for this application. If you do come up with a solution, let me know (@ me). I would love to see how you guys fix it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another method I tried (and failed to get to work) was to replace the path in the top-level route (<Route path="/" element={<LayoutComponent />} errorElement={<ErrorPage />}>) with something like path="/tabValue?", so the value of the child roots would be filled into that value, and theoretically still work, but in practice, it either absorbs everything, or breaks children routing.

It might be worth a shot? I'm not qualified enough in React to know if it's possible.

@SchrodingersGat
Copy link
Member

How important is it that the current "top level tab" is indicated in this fashion? There are many pages (e.g. settings / notifications / etc) which do not even fit under this scheme.

The component makes sense for switching between content within a single page, but maybe feels like the wrong solution for global path navigation...

Thoughts?

@wolflu05
Copy link
Contributor

Personally I really like this navigation to switch between the core parts of InvenTree and would miss it if it would be removed.

@SchrodingersGat
Copy link
Member

To be clear I am not talking about removing the tabs themselves - just the "current tab" indicator (unless we can work out a good way to implement)

@SchrodingersGat SchrodingersGat modified the milestones: 0.14.0, 0.15.0 Feb 26, 2024
@SchrodingersGat
Copy link
Member

I am bumping this to 0.15.0 until we have some consensus on a sensible solution

@SchrodingersGat SchrodingersGat modified the milestones: 0.15.0, 0.16.0 Apr 25, 2024
@SchrodingersGat SchrodingersGat modified the milestones: 0.16.0, 0.17.0 Aug 7, 2024
@matmair
Copy link
Member

matmair commented Aug 9, 2024

@CodingPupper3033 could you adress the merge conflict so we can get this into 0.16.0?

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
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Platform Header Tabs vanish on refresh
4 participants