You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prior to 3.24, when testing a component which contains a <LinkTo /> linked to a route with a dynamic segment, but a model was not provided the user would see the following error:
You attempted to generate a link for the "with-dynamic-segment" route, but did not pass the models required for
generating its dynamic segments
Since 3.24 there is no error and instead a LinkTo without an href is rendered.
This is very confusing since it seems like some links are just not working. It took quite a bit of debugging to realise that the lack of model arg was the problem. The old error message made it very obvious that something needed fixing to get linkto working as expected.
One possible solution would be to render an href with undefined in place of dynamic segment parts of the path.
🐞 Describe the Bug
Prior to 3.24, when testing a component which contains a
<LinkTo />
linked to a route with a dynamic segment, but a model was not provided the user would see the following error:Since 3.24 there is no error and instead a
LinkTo
without an href is rendered.This is very confusing since it seems like some links are just not working. It took quite a bit of debugging to realise that the lack of model arg was the problem. The old error message made it very obvious that something needed fixing to get linkto working as expected.
One possible solution would be to render an
href
withundefined
in place of dynamic segment parts of the path.for example:
🔬 Minimal Reproduction
https://github.com/lougreenwood/no-href-for-routes-with-dynamic-segments
Run the tests
See that links are generated with no
href
Change to version < 3.24
See that we see an error
😕 Actual Behavior
🤔 Expected Behavior
🌍 Environment
➕ Additional Context
Related:
LinkTo
with incomplete model failing in rendering tests #19364The text was updated successfully, but these errors were encountered: