Component state restored without mount() execution causing stale external data
0 reputation · 28 Apr 2020, 06:29 UTC
When Livewire restores a component's state from the encrypted blob, it skips the mount() and directly assigns persisted property values.
Consequently, any logic that resides in mount()—such as fetching fresh data from an external source—is not re‑executed, which can leave the component with stale information after a page refresh or navigation.
The goal is to keep the persisted UI values while ensuring that external data reflects the current state of the underlying source.
What mechanisms exist to trigger a refresh of external data after state restoration without re‑running mount()?
Can a lifecycle hook such as updated() be used to reload data while preserving persisted properties?
Is it necessary to move data‑fetching logic outside of mount() to a method that is invoked on each request regardless of state restoration?