Infolist not updating when form submitted on the same livewire component

I have a custom page with a form and infolist. The infolist displays data I get back from an API based on the inputted form data. When I call the submit action, nothing happens. A livewire request gets sent but no update to the value infolist entry. If I submit again it shows the previous search's data. Here is my little test page I created:
class Test extends Page implements HasSchemas
{
use InteractsWithSchemas;

protected string $view = 'filament.pages.test';

public array $data = [];

public array $someData = [];

public function mount()
{
$this->form->fill();
}

public function form(Schema $schema): Schema
{
return $schema
->statePath('data')
->schema([
TextInput::make('some_field'),

Actions::make([
Action::make('submit')
->action('submit'),
]),
]);
}

public function infolist(Schema $schema): Schema
{
return $schema
->constantState($this->someData)
->components([
TextEntry::make('value'),
]);
}

public function submit()
{
$this->someData = [
'value' => Str::uuid()->toString()
];
}
}
class Test extends Page implements HasSchemas
{
use InteractsWithSchemas;

protected string $view = 'filament.pages.test';

public array $data = [];

public array $someData = [];

public function mount()
{
$this->form->fill();
}

public function form(Schema $schema): Schema
{
return $schema
->statePath('data')
->schema([
TextInput::make('some_field'),

Actions::make([
Action::make('submit')
->action('submit'),
]),
]);
}

public function infolist(Schema $schema): Schema
{
return $schema
->constantState($this->someData)
->components([
TextEntry::make('value'),
]);
}

public function submit()
{
$this->someData = [
'value' => Str::uuid()->toString()
];
}
}
Blade:
<x-filament-panels::page>
{{ $this->infolist }}

{{ $this->form }}
</x-filament-panels::page>
<x-filament-panels::page>
{{ $this->infolist }}

{{ $this->form }}
</x-filament-panels::page>
Is this just a bug that I should report? What do you think?
8 Replies
toeknee
toeknee3w ago
Does it fail to validate? I suspect that will be why, since validate and getState validate the data before allowing actions to run.
Harvey
HarveyOP3w ago
Don't believe so, the state does get updated if I dump <pre>{{ $someData }} </pre> straight into the blade file, which happens after validation. Just not the infolist.
toeknee
toeknee3w ago
That's what I am saying though, if validate fails it will stop the chain returning the error. So if you dd($this->validate()) what does it say?
Harvey
HarveyOP3w ago
Have updated the name to avoid confusing myself
No description
toeknee
toeknee3w ago
Seems good to me
Harvey
HarveyOP3w ago
strange, guess it's a bug
Harvey
HarveyOP3w ago
Here's a video of it in action
Harvey
HarveyOP3w ago
I realise it also happens when the $this->validate() isn't there😂

Did you find this page helpful?