Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Sinnbeck's avatar
Level 102

Set isDirty with preserveState (inertia-react)

I have a list of input fields that is used to filter the page. The form is submitted on each onBlur() event. The problem is that I want to retain input focus after submit. Therefor I set preseveState to true, to retain focus. But this means that isDirty will remail true

Is the some clever way to manually set isDirty?

I have tested with reset() after successfully submitting but that just resets the form to how it looked before submit

0 likes
3 replies
furqanDev's avatar

You can use Inertia's onFinish Global event to set it.

Sinnbeck's avatar
Level 102

@furqanDev But how would you set it? It seems to be a "computed" value. My current idea is to write my own implementation, but if I could use the inertia version that would be great :)

1 like
Sinnbeck's avatar
Sinnbeck
OP
Best Answer
Level 102

I found out the errror. It was because laravel was returning the set ID's as strings..

Fixed by casting all values to integers in the response from laravel

Please or to participate in this conversation.