F
Filament2mo 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: https://discord.com/channels/883083792112300104/1311097526434267298, 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
ListCompanies.php
GitHub Gist: instantly share code, notes, and snippets.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?