T
TanStack9mo ago
unwilling-turquoise

useMatches re-renders twice on server with different amount of matches

Hey folks, I'm implementing breadcrumbs and ran into hydration errors. These happen because the component renders twice on the server, with a different number of matches. Here's the log, first matches mapped to match.fullPath and then matches.length
[
'/',
'/$owner/$repository',
'/$owner/$repository/issues',
'/$owner/$repository/issues/$issueNumber'
] 4
[ '/', '/$owner' ] 2
[
'/',
'/$owner/$repository',
'/$owner/$repository/issues',
'/$owner/$repository/issues/$issueNumber'
] 4
[ '/', '/$owner' ] 2
I'm loading this route /$owner/$repository/issues/$issueNumber On the client the component renders only once with the correct amount of matches (4) Is this expected behavior?
1 Reply
unwilling-turquoise
unwilling-turquoiseOP9mo ago
Let me know if a reproduction would help

Did you find this page helpful?