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 Routing Logic for Proper Conditional Layout Rendering #287

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

agrawalshreyansh
Copy link
Contributor

@agrawalshreyansh agrawalshreyansh commented Feb 4, 2025

This PR refactors the routing logic in AppRoutes.tsx to correctly handle conditional rendering of layout routes.

Changes Made:

Separated Initial Route: The /initial route is now handled independently and does not render the layout wrapper.
Fixed Layout Wrapping: The layout () is now applied only to routes that match entries in ROUTES.LAYOUT, using path="/*" to catch all layout routes.
Improved Routing Logic: Conditional rendering of layout routes is streamlined, ensuring proper handling of both layout and non-layout pages.
Reason for Change:

To ensure that the layout wrapper is applied correctly to relevant routes while keeping the /initial page unaffected by the layout.
Expected Behavior:

The /initial route renders without the layout.
All other routes requiring the layout will render correctly within the layout wrapper.

Related Issue: This change addresses the issue raised in #286 , which highlights the incorrect conditional rendering of layout routes.

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.

1 participant