leptos
leptos copied to clipboard
Double fetch when starting at `ParamSegment` at some route belonging to `ParentRoute`, navigate to parent and back down
Describe the bug
Initially thought to be only applicable to changes introduced in #2959, I've retested my reproduction steps below against 827cc0bdfa (which was thought to fix everything related to #2937) and the double fetch is in fact reproducible.
I've updated the same gist once more as I've been workshopping that into a fully standalone base for the regression test I've mentioned previously.
To Reproduce Steps to reproduce the behavior:
- Keep the Network developer tool open for the browser
- Ensure that the page is hydrated while under
Target 3##
(i.e./item/3/
) - Navigate to
Item Listing
via the link to get CSR rendering - Navigate to
Target 4##
via the link - See that
get_item
is fetched twice. - Similar behavior will occur when starting from
Target 41#
, navigate toTarget 4##
, thenTarget 42#
, and this would double fetchinspect_item
. Since the logging is instrumented more thoroughly for this component, this reproduction step may provide additional hints of what happened. - This is only triggered if the parameter has changed from the initial condition, that is, starting at
Target 42#
, go toTarget 4##
then back toTarget 42#
will not trigger the double fetch, but once it hitsTarget 41#
(being different to the start) then the double fetch behavior will continue until the rootParentRoute
is fully unmounted (that is, going back to Home). - This also only affect the same component, that is, if you start at
Target 3##
, thenItem Listing
thenTarget 4##
, going toTarget 41#
will not trigger the double fetch. Navigating back toTarget 3##
orTarget 4##
will once again trigger the double fetch.