Skip to content

[Feature Request / Question] Search Params at the Layout Level #23

@JonParton

Description

@JonParton

Hi There!

Thanks for tackeling this problem! Really cool way of approaching it and giving ownership 🙌 Also thank you for all the time on your videos too; Learnt so much over the years!


I have a use case that I wondered if there was already a way to support or if there was any desire to do so? 🤔

In some cases you may want to add a Search Param that can be used anywhere below a certain level in the routing tree, and not sure how to handle this.

For example if you have a client side Modal that you include in layout.tsx at the root level, say to show Notifications ,and it's open state were stored in the URL search params of any route below it like /profile/edit?showNotifications=true or /?showNotifications=true it would be cool to be able to merge that possible search param into all type definitions for routes underneath.

This may take the form of being able to add a layout.info.ts file that defines shared params for the routes below it? Or would there be a better way to handle this?


(p.s. also aware there may be a different way of approaching the example using intercepting routes server side too but I'm actually less of a fan of the modal client side, full page on bare URL navigation convention for some use cases... Maybe some more learning required for me!)

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