FilamentF
Filament5mo ago
Tieme

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.
  • 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.
Gist with details/code: https://gist.github.com/sitenzo/092845b8dc498e8642e7ec15eae8a1e1

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
Any pointers would be greatly appreciated—thanks!
Gist
GitHub Gist: instantly share code, notes, and snippets.
Was this page helpful?