Relationship is empty after save
After saving a form that contains a relationship the relationship section is empty.
The data is correctly stored and fetched but filament clear the data.ralationship node by filling all the components states with null values.
I've tried to trace the issue out and I've seen that:
EditRecord.php
call the $this->form->getState()
.
this method is the responsible of the data object to be overwritten.
More specifically is the loadStateFromRelationship()
that when run the data is not somehow re-fetched and null is loaded instead. $this->fillStateWithNull()
is called inside the component.
Why the data is not loaded correctly after the save?
Below the form schema:
5 Replies
This is outside the panel, right?
this is a resource, and the page is a class "MyResourceEditPage" that extend an EditRecord.
For now I have added a redirect url to the same page via the getRedirectUrl as a workaround.
I'm not 100% sure what is wrong with the code.
I nitially I thoungt it was the coditional relatioship it it seems it is not at it is correctly evaluated and even hardcoding the value to true the issue is present.
If necessary I can try to spin up a demo repository.
Does the same happen with the normal edit page? Can you share code specific to your page?
You say „the relation section“ but all you posted is a select. Maybe share more code and a screenshot.
@Dennis Koch i think this is actually a bug. I’ve seen similar using layout components with relationships. Everything saves correctly but the livewire data is reset for the relationship. Reloading the page fetches the updated data.
I'll provide an example later today once my boss approve the time 😄