inertiajs / inertia-laravel

The Laravel adapter for Inertia.js.
https://inertiajs.com
MIT License
1.99k stars 222 forks source link

Inertia components/hooks wrapped with redux Provider stopped working #614

Closed domjesus closed 2 months ago

domjesus commented 2 months ago

Hello everyone. I don't know if here is the correct place to this, if don't feel free to guide me. I'm using Laravel 10 with Inertia. Now I'm trying to integrate a layout that uses redux to manage UI state. I noticed that when I imported the redux tools

import { configureStore } from "@reduxjs/toolkit"; import rootReducer from "./slices"; import { Provider } from "react-redux";

const store = configureStore({ reducer: rootReducer, devTools: false });

and wrapped the App component with provider

<Provider store={store}> <App {...props} /> </Provider>

some Inertia features stopped working, such as Link component and form submission like post(route("login")), showing on console the error @inertiajs_react.js?v=d680deed:3399 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'x-inertia') at C.isInertiaResponse (@inertiajs_react.js?v=d680deed:3399:45) at @inertiajs_react.js?v=d680deed:3441:17

image

The requests (GET or POST), through Link or hook forms don't even reachs the backend.

The routes on backend are still working and when I changed a Link to a <a></a> tag works, but full reloading the page. If someone can help me I'll really appreciate.

Thank you very much.

My stack: Laravel Version: 10.48.8 InertiaJS/React: 1.0.0 Vite: 4.0.0 React 18.2.0.

driesvints commented 2 months ago

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.

domjesus commented 2 months ago

Thank you for your directions. I’ll try these channels.

Wandeir Carneiro

Em qui., 25 de abr. de 2024 às 04:21, Dries Vints @.***> escreveu:

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.

— Reply to this email directly, view it on GitHub https://github.com/inertiajs/inertia-laravel/issues/614#issuecomment-2076635589, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5VJSCGRHV3UFZR2562IV3Y7C4IBAVCNFSM6AAAAABGVU7YDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZWGYZTKNJYHE . You are receiving this because you authored the thread.Message ID: @.***>