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

refactor: move all the routes one level deeper to enable layoutless routes #1009

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

WilsonNet
Copy link
Collaborator

@WilsonNet WilsonNet commented Feb 25, 2025

Description

right now the layout is in the root of the app, so a solution to create
routes without the layout is to move all routes one level deeper

How to test

See if the app is working as usual, try to create a new route without layout in the app and test it

image

Closes #1010

@WilsonNet WilsonNet force-pushed the feat/log-viewer-page branch from 623c134 to 898a956 Compare February 25, 2025 19:28
@WilsonNet WilsonNet changed the title Feat/log viewer page refactor: move all the routes one level deeper to enable layoutless routes Feb 25, 2025
@WilsonNet WilsonNet marked this pull request as ready for review February 25, 2025 19:31
Copy link
Contributor

@murilx murilx left a comment

Choose a reason for hiding this comment

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

Worked well on my tests. Just some nitpicks

Comment on lines 39 to 40
const searchParams = useSearch({ from: `/_main${ISSUE_ROUTE}` });
const { issueId } = useParams({ from: `/_main${ISSUE_ROUTE}` });
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: wouldn't it be more readable if we had another constant with the additional path? Like

PATHLESS_ISSUE_ROUTE = `/_main${ISSUE_ROUTE}`

but I'm not so sure about this

Copy link
Collaborator

Choose a reason for hiding this comment

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

Other components, like BuildDetails and Hardware Details, the path is given as a string. If you will follow this way, it's should be a pattern in application. I don't think that this is necessary for now

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case I say we remove ISSUE_ROUTE altogether and just write _main/issue/$issueId

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the routes are type safe, no need for an ISSUE_ROUTE constant, deleted it

@@ -0,0 +1,3 @@
import { createFileRoute } from '@tanstack/react-router';

export const Route = createFileRoute('/_main/hardware/$hardwareId/boot')({});
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I don't think you need to pass an empty object here. See the route for /_main/tree/$treeId/test/$testId you also did

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I deleted it, it wasn't needed

@@ -0,0 +1,3 @@
import { createFileRoute } from '@tanstack/react-router';

export const Route = createFileRoute('/_main/hardware/$hardwareId/build')({});
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto about empty object

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ditto about deleting

@@ -0,0 +1,3 @@
import { createFileRoute } from '@tanstack/react-router';

export const Route = createFileRoute('/_main/hardware/$hardwareId/test')({});
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto about empty object

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ditto about deleting

@WilsonNet WilsonNet force-pushed the feat/log-viewer-page branch 2 times, most recently from 1749230 to c7e5cb5 Compare February 26, 2025 13:19
Copy link
Collaborator

@Francisco2002 Francisco2002 left a comment

Choose a reason for hiding this comment

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

LGTM

@WilsonNet WilsonNet force-pushed the feat/log-viewer-page branch from c7e5cb5 to f4c174c Compare February 26, 2025 14:59
layout

right now the layout is in the root of the app, so a solution to create
routes without the layout is to move all routes one level deeper

Closes #1010
@WilsonNet WilsonNet force-pushed the feat/log-viewer-page branch from f4c174c to 0473c44 Compare February 26, 2025 15:11
@WilsonNet WilsonNet merged commit 89a0599 into main Feb 26, 2025
5 checks passed
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.

refactor: move all the routes t with a layout to a pathless route
3 participants