-
Notifications
You must be signed in to change notification settings - Fork 506
Description
Versions:
@inertiajs/vue3
version: ^2.0.x
Describe the problem:
Since version 2.x (we're using the Vue3 adapter, but I assume this issue is the same in React and others since the logic is shared), there's been inconsistent behavior when doing back navigation through a site's history.
There are currently two scenarios for how site navigation works, which are different based on whether you're navigating to a page that makes use of the useForm helper with or without a remember key (as described in https://inertiajs.com/forms).
Steps to reproduce:
Scenario 1 (using a remember key):
- Start on a page that doesn't make use of a useForm element (for example users.index)
- Navigate to a user edit page (via e.g. a table row click, so we land on users.1.edit page, that has a useForm usage like useForm('EditUserForm', { id: props.user.id, name: props.user.name }))
- Navigate back (via browser back button) and you will land on the users.index page again as expected
- Navigate to another user edit page (e.g. user.2.edit)
- When navigating back, you will now land on the user.1.edit page, instead of the expected users.index page
- If you navigate back once further, it will completely skip the users.index page, and go back to a previous page
Scenario 2 (not using a remember key)
- Once again, start on the users.index page
- Navigate to users.1.edit (where we make use of useForm without a rememberKey, so useForm({id: props.user.id, name, props.user.name})
- Navigate back, you will land on users.index as expected
- Navigate to users.2.edit
- Navigate back, you will once again land on users.index as expected
- Continue the above pattern infinitely, works as expected
In version 1.x of the InertiaJS library, site navigation always worked the same way as described in scenario 2, which I would say is the expected scenario. If nothing else, an end user would expect the site navigation to behave consistently, regardless if we use the form helper with or without rememberKeys.
Up to version 2.0.13, there was also an issue with the forms misremembering data, but that was fixed in the 2.0.14 version by #2401, so this is the only inconsistency leftover from the 2.x migration that we've detected.