Inertia refs do not update on page reload

146 Views Asked by At

If in my controller I redirect back:

 return redirect()
            ->back()
            ->with('status', $status ?? [
                'message' => 'Message here...',
            ]);

Then, when redirected back, the prop is updated, but my component does not update it's refs:

const active = ref(Boolean(props.message));

The only way to get it to work is either, make the component react to the prop (but they I cannot change the active state of the component from the component itself). Or to use preserveState: false soemthing which I do not wish to do as I need certain parts of the state preserved.

Is there a way around tis I have yet to think of?

0

There are 0 best solutions below