Path configuration: Difference between replace_root and clear_all? #172
-
|
https://native.hotwired.dev/reference/navigation
clear_all and replace_root seem to have the same description, so I'm not sure what the difference is supposed to be? I have been trying to get the log in page of my app to reset the navigation stack, and clear_all does a weird thing where it changes the title but doesn't actually replace the existing root page (maybe a bug?), and replace_root does render the login page for me, but I've got a straggling right bar button from a bridge component on the page that was replaced, so this is also not helpful. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Both pop to the root screen on the current navigations tack.
|
Beta Was this translation helpful? Give feedback.
-
|
As a side note, the bug I was experiencing was this: I have a root view with rightBarButtonItems set using a bridge component (something like https://github.com/joemasilotti/bridge-components/blob/main/ios/components/ButtonComponent.swift, but in my case I append to The custom turbo stream action ultimately runs [1] The reason is because I wanted to create a bridge component to do some custom handling on logout, so I couldn't use a regular form post because then the view would disappear before I could run my native logout handler. So... I guess I can either do the equivalent of replace_root there, or I can just go back to a regular form request to destroy the session because the need for the custom logout handling is less now (it was related to navigation tabs, but I've gotten rid of the navigation tabs from my app). |
Beta Was this translation helpful? Give feedback.

Both pop to the root screen on the current navigations tack.
clear_allreloads whatever screen was there. Butreplace_roottakes the new navigation and substitutes that for the first screen on the stack.