You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When navigating back/forward from pages, the router only checks that window.history.state is not empty, but this can conflict with other navigation frameworks (in my case Turbo/Hotwire, which uses window.history.state.turbo). This in turn leads to the resolve function passed to createInertiaApp being called with an undefined arg.
Steps to reproduce:
Set window.history.state to any truthy value before initializing Inertia
The text was updated successfully, but these errors were encountered:
ariel-codes
changed the title
Router only checks that window.history.state is _not empty_, breaks when used with other frameworks
Router only checks that window.history.state isn't empty, breaks when used with other frameworks
Jul 11, 2024
@ariel-codes I'm curious about how you're integrating Inertia.js with Turbo/Hotwire, as they generally aim to solve similar problems but in different ways. It's my understanding that Turbo drives navigation and partial updates without the need for a front-end framework, while Inertia integrates tightly with frameworks like Vue, React, and Svelte.
Since both manipulate the history.state, it's understandable that there would be conflicts in scenarios where both are being used. As for Inertia, we might need a safeguard to confirm the presence of Inertia-specific data in history.state before continuing execution.
Versions:
@inertiajs/core
version: 1.2.0@inertiajs/vue2
version: #.#.#@inertiajs/vue3
version: #.#.#@inertiajs/react
version: 1.2.0@inertiajs/svelte
version: #.#.#Describe the problem:
When navigating back/forward from pages, the router only checks that
window.history.state
is not empty, but this can conflict with other navigation frameworks (in my case Turbo/Hotwire, which useswindow.history.state.turbo
). This in turn leads to theresolve
function passed tocreateInertiaApp
being called with an undefined arg.Steps to reproduce:
window.history.state
to any truthy value before initializing InertiaThe text was updated successfully, but these errors were encountered: