leptos icon indicating copy to clipboard operation
leptos copied to clipboard

Double fetch when starting at `ParamSegment` at some route belonging to `ParentRoute`, navigate to parent and back down

Open metatoaster opened this issue 5 months ago • 0 comments

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:

  1. Keep the Network developer tool open for the browser
  2. Ensure that the page is hydrated while under Target 3## (i.e. /item/3/)
  3. Navigate to Item Listing via the link to get CSR rendering
  4. Navigate to Target 4## via the link
  5. See that get_item is fetched twice.
  6. Similar behavior will occur when starting from Target 41#, navigate to Target 4##, then Target 42#, and this would double fetch inspect_item. Since the logging is instrumented more thoroughly for this component, this reproduction step may provide additional hints of what happened.
  7. This is only triggered if the parameter has changed from the initial condition, that is, starting at Target 42#, go to Target 4## then back to Target 42# will not trigger the double fetch, but once it hits Target 41# (being different to the start) then the double fetch behavior will continue until the root ParentRoute is fully unmounted (that is, going back to Home).
  8. This also only affect the same component, that is, if you start at Target 3##, then Item Listing then Target 4##, going to Target 41# will not trigger the double fetch. Navigating back to Target 3## or Target 4## will once again trigger the double fetch.

metatoaster avatar Sep 10 '24 13:09 metatoaster