Forcing server props fetch #1500
Unanswered
gabrielrotbart
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I've got two scenarios where props are not being fetched that I would like to force.
PersonForm
for both a create and an edit form. They are basically identical other than the first has no Person data and the other one does (and uses the object to pre-fill the form). However, when navigating between the two, the person prop is not re-fetched / reloaded so if these steps are taken:/person/1/edit
- person prop:{name: 'Some name'}
- The form is pre-filled/person/new
- person prop remains{name: 'Some name'}
- The form is still pre-filledThe same applies the other way, the edit form will remain empty due to person prop being
{}
coming in from the create page.How do I force Inertia to fetch props between the two routes without needing different components?
Links are constructed via a component:
This is the DOM render:
I tried adding
preserveState={false}
even though I think that's the defaultperson/1/edit
, fetching{name: 'Old name'}
/some_other_route
'New name'
, in the back endperson/1/edit
- person prop will still be{name: 'Old name'}
How do I force a re-fetch on history changes?
Stack:
Thanks a lot for your help
Beta Was this translation helpful? Give feedback.
All reactions