Skip to content

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

@agrawalshreyansh

Description

@agrawalshreyansh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions