mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
fix: Partially render deferred filters form after action used
This commit is contained in:
@@ -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 {}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user