According to me, it's not a Laravel or InertiaJS problem, but a svelte problem.
Sep 10, 2023
2
Level 2
Inertia not rendering after redirect
ive got a inertia svelte application and just added a login page, but after login, after redirecting the user back home, nothing gets rendered on the home route, but in the svelte devtools, the data passed from the backend exists, only after a reload the page gets rendered, not even a console log is shown when called from the home page
Authentication logic
public function authenticate(LoginRequest $request)
{
if(Auth::attempt($request->validated(), true)) {
Session::regenerate();
return to_route('chats.index');
}
return back()->withErrors(['email' => 'Wrong email or password']);
}
Home
public function index()
{
$user = Auth::user();
$chats = $user->chats()
->with(['messages.author', 'user' => function(HasOneThrough $query) use($user) {
$query->whereNot('users.id', $user->id);
}])
->get();
return Inertia::render('Chats/Index', [
'chats' => $chats
]);
}
for anyone wondering, im using chats.index as my home route btw here is the repo https://github.com/salfel/chattenger
Please or to participate in this conversation.