solidjs / solidjs/solid-router
Cannot read properties of undefined (reading 'length')
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 180
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 19
Description
Describe the bug
It took me forever to debug an error because the error message got lost by the router. Demonstration:
function throwError(): string {
throw new Error('A meaningful error message');
}
<Route
path={throwError()}
element={<div>hello</div>}
/>
This leads to the following error:
Uncaught TypeError: Cannot read properties of undefined (reading 'length')
at components.jsx:40:43
at dev.js:453:34
at untrack (dev.js:434:12)
at Object.fn (dev.js:453:20)
at runComputation (dev.js:696:22)
at updateComputation (dev.js:679:3)
at Object.readSignal (dev.js:612:67)
at get when [as when] (components.jsx:64:25)
at Show.createMemo.equals [as fn] (dev.js:1443:44)
at runComputation (dev.js:696:22)
The original error message ('A meaningful error message') got lost.
Platform
- OS: Windows
- Browser: Chrome 113
- Solid: 1.7.6
- Solid router: 0.8.2
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 reproducing the throwing path shown in the issue and inspect the router code involved in the components.jsx stack trace, especially the handling of route evaluation errors. Confirm that the original error message, “A meaningful error message,” is preserved instead of being replaced by the undefined-length TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100