"Type instantiation is excessively deep and possibly infinite." error occurring on `navigate`
The error goes away when I comment any leaf node route from the tree. So I don't think it's a specific route causing the issue. I see this was an issue previously but was meant to be fixed? (not totally clear, didn't follow whole discussion/PR).
The code in navigate call in question only uses
to and params:
Does anyone know how to fix this
I'm on version 1.7.0.5 Replies
unwilling-turquoise•2y ago
this is most likely a circular dependency
to get around this, do not use
route.to but spell out the path as a string literal
'/foo/bar'extended-salmonOP•2y ago
Thanks for the fast response! I'll try that
It actually didn't fix the issue so I messed around a bit more with the code a bit more, and to fix it I actually had to remove the
from in my useNavigate call.
and now the original code is no longer triggering this errorunwilling-turquoise•2y ago
can you provide a minimal example?
setting "from" is helpful when dealing with path / search params in a reducer way
if you don't need that, all good
extended-salmonOP•2y ago
I wish I could provide a minimal example, but my current setup is pretty extensive so I'm not sure I have the time to trim it down unfortunately.
But yeah in my case, I have all params I need for the route available in my component, so no need to merge in prev params in these
navigate calls.
Just saw you published a new version, and it also seems to fix the issue! When I add back the from to my useNavigate call it seems to be fixed. Just to be sure I rebuilt my app from scratch and restarted TS server in VSCode -- error is gone in both contexts! 🥳xenial-black•2y ago
I was hitting the same thing, narrowed it down to a
validateSearch. I don't have a minimal example, but adding a single empty validateSearch to a route in my project causes tsc --project . to go from 4.9 seconds to 10.4 seconds and Type instantiation is excessively... starts happening anywhere I'm calling useMatchRoute()().