© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
9 replies
Marc

Refresh the form after saving in SPA mode

How can I refresh the form while in SPA mode after saving data?

I make the following modification before storing the value to the database:
->dehydrateStateUsing(function ($state) {
    return str($state)->slug()->toString();
})
->dehydrateStateUsing(function ($state) {
    return str($state)->slug()->toString();
})

But for some reason, after saving, the value remains the same as what the user has entered, you have to reload the page (F5) to show the real value.

A solution for this is:
->lazy()
->afterStateUpdated(function ($state, $set) {
    $set('slug', str($state)->slug()->toString());
})
->lazy()
->afterStateUpdated(function ($state, $set) {
    $set('slug', str($state)->slug()->toString());
})

But this presents another problem, if the user is editing the field and clicks on the save button, the data is not saved.
I suppose it is because he is making the AJAX call to afterStateUpdated and the save button is disabled even though it is not visible visually.

So, how can I recharge the state without having secondary problems?
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Refresh form after calling model function
FilamentFFilament / ❓┊help
3y ago
Updating input after saving the form
FilamentFFilament / ❓┊help
2y ago
Redirect in SPA mode
FilamentFFilament / ❓┊help
3y ago
SPA mode in Safari
FilamentFFilament / ❓┊help
3y ago