solidjs / solidjs/solid-router
[feat] Conditional routing
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 180
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 19
Description
My feature request is simple, adding conditional routing. The proposal is to add two properties from the Show component into the RouteDefinition interface.
when: () => booleanfallback: () => JSX.Element | string | Array<JSX.Element | string>
if when is not defined, use a default value that always computes to true. If the computed value of when() is false render fallback() instead of component or element.
In my opinion this allows a much cleaner syntax for creating routes that should only be available when certain conditions are met. If the conditions are not met it offers a simple way to show the end-user that some condition was not met. If fallback is not defined, treat the route as it is a 404.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Show component and the RouteDefinition interface mentioned in the proposal, then trace how routes render component or element. Determine how conditional evaluation and fallback rendering fit the existing routing flow. Done means RouteDefinition supports when and fallback, with the specified defaults and 404 behavior when no fallback is provided.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100