fix: Partially render deferred filters form after action used

This commit is contained in:
Dan Harrin
2025-09-16 11:44:07 +01:00
parent 7da2a51ffc
commit 2469a77d2e
@@ -14,6 +14,7 @@ use Filament\Schemas\Contracts\HasSchemas;
use Filament\Schemas\Schema;
use Filament\Support\Exceptions\Cancel;
use Filament\Support\Exceptions\Halt;
use Filament\Support\Livewire\Partials\PartialsComponentHook;
use Filament\Tables\Contracts\HasTable;
use Illuminate\Auth\Access\Response;
use Illuminate\Database\Eloquent\Model;
@@ -309,6 +310,8 @@ trait InteractsWithActions
return $result;
}
$this->partiallyRenderActionParentSchema($action);
$action->resetArguments();
$action->resetData();
@@ -329,6 +332,28 @@ trait InteractsWithActions
return $result;
}
protected function partiallyRenderActionParentSchema(Action $action): void
{
$actionSchema = $action->getSchemaContainer() ?? $action->getSchemaComponent()?->getContainer();
$schemaToPartiallyRender = null;
while ($actionSchema !== null) {
if ($actionSchema->shouldPartiallyRender()) {
$schemaToPartiallyRender = $actionSchema;
}
$actionSchema = $actionSchema->getParentComponent()?->getContainer();
}
if (! $schemaToPartiallyRender) {
return;
}
app(PartialsComponentHook::class)->renderPartial($this, fn (): array => [
"schema.{$schemaToPartiallyRender->getKey()}" => $schemaToPartiallyRender->toHtml(...),
]);
}
protected function afterActionCalled(): void {}
/**