S
SolidJS2mo ago
klequis

OptionalParams in route not working

I'm not getting the expected result using optional params - routes -- users ---- [[id]].tsx ---- index.tsx -- [...404].tsx url: http://localhost:3000/users/1/2 [[id]].tsx
export default function UsersOptionalParams() {
return (
<div class="component">
<p class="file-name">routes/users/[[id]].jsx</p>
</div>
);
}
export default function UsersOptionalParams() {
return (
<div class="component">
<p class="file-name">routes/users/[[id]].jsx</p>
</div>
);
}
It is routing to [...404]
7 Replies
peerreynders
peerreynders2mo ago
It's working as expected: - /users/1 -> id = 1 - /users/1/2 -> page not found (there is no path to (/users/1)/2) Maybe you are looking for src/routes/users/[...id].tsx
peerreynders
peerreynders2mo ago
OK looks like I'm wrong.
peerreynders
peerreynders2mo ago
Compare with this
SolidStart Release Candidate Documentation
SolidStart Release Candidate Documentation
Early release documentation and resources for SolidStart Release Candidate
peerreynders
peerreynders2mo ago
I think optional simply means no need for index.tsx and [id].tsx; just use [[id]].tsx instead. To my knowledge /users/1/2 would require a catch-all route
klequis
klequis2mo ago
Logical. But in that case the doc seems to be wrong because in testing that it matches /users and /users/1 but not /users/1.2. I'll ask the cocs team.
Want results from more Discord servers?
Add your server
More Posts
Reactivity resulting from updates in a websocket event listenerI am struggling to understand why setting a signal in an event listener is not driving re-rendering How do i conditionally add something to <head> based on what createAsync returns?I need to wait for a resource coming from `createAsync` so then i can decide whether i should add goHow do you delete an entry in an array when using `createStore`In the following documentation, this case is not presented: https://docs.solidjs.com/guides/complex-Uncaught ReferenceError: React is not definedHey there! Please help. I can't figure out this error. I have a tiny solid-js project that works okWhat do I do if I have to wait for things to happen, meanwhile define extra state or whatthis piece of code come up as crucial functionality all over the place for me, for an interactive apVinxi build failing in CIHi, I wanted to use SolidStart for my project and the website builds fine locally, but in GItHub actReactivity in single table cell from memoized data[Moving from this thread (https://discord.com/channels/722131463138705510/1241054227485425734/124162Insights on my component libraryHello, i'm building my own component library to fit my project needs. I'm having a bit of a problem Assistance with SolidStart and Supabase Auth in SSRI am currently trying to piece together exactly how to setup `SolidStart` with the `@supabase/ssr` pWhy is solid start dev site so heavy?I ran `pnpm create solid`, picked the basic template, then ran `dev` to encounter almost 10mb of js