Hello,
form.post(
route('player.quest.step.challenge.validate', { quest: props.quest_id, step: props.step_id, challenge: props.challenge }),
{
preserveScroll: true,
onSuccess: (page) => {
validated.value = page.flash.validated;
},
},
);
public function validate(PlayerChallengeValidationRequest $request, Quest $quest, Step $step, Challenge $challenge)
{
$answer = $request->answer;
$validated = $challenge->validate($answer);
Inertia::flash('validated', $validated);
return back();
}
I need to send the response to the frontend and preserve the scroll position.
The code above doesn't preserve the scroll position and I don't understand why.
Any idea ? I think that it's due to the return back() line.
Is there any way to perform an InertiaJS response with flash data with scroll position preservation ?
Thanks for your help.
V