S
SolidJS17mo ago
Tommypop

Value returned from routeData is undefined

The value returned from routeData isn't defined, even after waiting before accessing
18 Replies
Tommypop
Tommypop17mo ago
The code relating to the routeData is pretty much copied and pasted from the docs
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Tommypop
Tommypop17mo ago
I've tried using it in JSX
Tommypop
Tommypop17mo ago
Could it be due to where it is located in the layout tree?
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Tommypop
Tommypop17mo ago
the function isn't even called I've added a log, which doesn't run
Tommypop
Tommypop17mo ago
Tommypop
Tommypop17mo ago
Here's the JSX I just added it there for testing routeData doesn't even get called
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Tommypop
Tommypop17mo ago
Done
Tommypop
Tommypop17mo ago
Still undefined and none of those logs are triggered Apart from the one in the memo Which prints undefined
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Tommypop
Tommypop17mo ago
I'm looking in the terminal Yep :) Could it be because it's in the same file as a Context Provider or because it's before the routes in the tree Actually, that sounds like it could be the problem
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Tommypop
Tommypop17mo ago
Yeah Awesome I guess I'll just fall back on my old way Which needs artificial delay to work for some reason :) Yeah And even then it's not reliable but at least it's only on initial page load I've put it inside of a route and still nothing :(
Tommypop
Tommypop17mo ago
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Tommypop
Tommypop17mo ago
Yeah Good idea Thanks for all the help and advice