Turn off unsaved changes warning for a single action (unsavedChangesAlerts)
Hi all,
I’m trying to disable the unsaved changes alert for a specific action.
I’ve tried the approach mentioned here: ❓┊helpHow to disable ->unsavedChangesAlerts() for a single form?, but even after adding it to the ListRecords page, the alert still appears.
Context: this action is essentially a search/lookup.
Workaround so far: setting
Question: Is there a way to completely disable the unsavedChangesAlerts for this action?
Alternatively, is there a way to remove the input field when
What i tried
I’m trying to disable the unsaved changes alert for a specific action.
I’ve tried the approach mentioned here: ❓┊helpHow to disable ->unsavedChangesAlerts() for a single form?, but even after adding it to the ListRecords page, the alert still appears.
Context: this action is essentially a search/lookup.
- There’s a single input field.
- The action checks whether a code exists; if it does, it shows a summary in a view field and changes the submit action to redirect to the corresponding company.
Workaround so far: setting
$livewire->mountedActions = []; (see the gist). This suppresses the alert, but it throws an error if someone types into the input field.Question: Is there a way to completely disable the unsavedChangesAlerts for this action?
Alternatively, is there a way to remove the input field when
$livewire->mountedActions is an empty array?What i tried
- Adding another footer action instead of changing the submitaction (same alert)
- Added
protected ?bool $hasUnsavedDataChangesAlert = false;to ListRecords - added
->schema([])to submitaction
