`loaderData` always possibly undefined in the `head` ?
Hello,
I see that from the types, the
loaderData in the head of a route can always be undefined, but in my test it always returns the value of the loader ?
Can we use the data or it can be possibly underfined thus useless ?
4 Replies
robust-apricot•4mo ago
head is invoked also when a loader fails
graceful-blueOP•4mo ago
Oh okay I see make sens, so we can take for granted that if there is no failure, the data will be defined ?
robust-apricot•4mo ago
yes but you need to check in head if loader data is defined
graceful-blueOP•4mo ago
yes ofc, thank you !