useHash: Cannot read properties of undefined (reading 'substring')
See original GitHub issueThe argument here passed to the callback
is an Event
object from the hashchange
here
https://github.com/kyeotic/raviger/blob/10d24e63b6c9f9329cc34df6365c639fca5cc529/src/location.ts#L87
It doesn’t have a hash
property.
Maybe consistently use window.location.hash
and ignore the argument altogether.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'substring' of undefined in react
My hypothesis is that you get undefined because you are trying to see the result without have some async/await in place (or some...
Read more >Cannot read Property 'substring' of Undefined in JavaScript
The "Cannot read property 'substring' of undefined" error occurs when calling the `substring()` method on an `undefined` value. To solve the error, ...
Read more >TypeError: Cannot read property 'substr' of undefined #4275
While everything worked during development now suddenly cloning a fresh repo fails with TypeError: Cannot read property 'substr' of ...
Read more >JavaScript Hash Table – Associative Array Hashing in JS
Hash Tables are a data structure that allow you to create a list of paired values. You can then retrieve a certain value...
Read more >css-loader | webpack - JS.ORG
string - disables CSS Modules for all files and set the mode option, more information you can read here; object - enable CSS...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t understand how this one got around our tests. Does jsdom produce invalid
hashchange
events? I’m also surprised it took this long to find.Oof, terrible first impression. Thank you for reporting the bug and not just moving on 😄