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

BUG: Fix Conditional Rendering of Layout Routes in AppRoutes.tsx #286

Open
2 tasks done
agrawalshreyansh opened this issue Feb 4, 2025 · 1 comment
Open
2 tasks done

Comments

@agrawalshreyansh
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

Problem: The current routing setup in AppRoutes.tsx conditionally renders the layout routes only when the current path is included in ROUTES.LAYOUT. However, this causes issues when navigating to non-layout routes (e.g., /initial). The layout rendering logic is not correctly isolated, causing unnecessary checks and potentially leading to errors or unexpected behavior when routing.

Proposed Solution:

Separate Routing for Initial Page: Ensure that the /initial route is handled separately without rendering the layout.
Proper Layout Wrapping: Use path="/*" to catch all routes that should be wrapped by the layout (LayoutRoutes), ensuring the layout is applied only for routes listed in ROUTES.LAYOUT.
Conditional Rendering: Only wrap the layout routes with when the current path matches one of the layout routes.
Changes Needed:

Refactor the routing logic in AppRoutes.tsx to correctly separate the initial route from layout routes.
Ensure that routes requiring the layout are wrapped with while other routes like /initial are handled independently.
Expected Result:

The initial page (/initial) should be shown without the layout wrapper.
Other routes (/home, /videos, etc.) should correctly display with the layout, without any extra checks.

Record

  • I agree to follow this project's Code of Conduct
@genius-0963
Copy link

Initial Page (/initial): Handled independently without any layout wrapper.
Layout Routes: Wrapped under a single Route with path="/*", ensuring all layout-dependent routes are properly managed.

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

No branches or pull requests

2 participants