fix: Egg edit form not refreshing after import or update (#2358)

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
This commit is contained in:
wuzuantw
2026-06-20 03:10:29 +08:00
committed by GitHub
parent ed7d4f5a6b
commit fab5da496f
2 changed files with 8 additions and 1 deletions

View File

@@ -303,7 +303,11 @@ class EditEgg extends EditRecord
->tooltip(fn (Egg $egg): string => $egg->servers()->count() <= 0 ? trans('filament-actions::delete.single.label') : trans('admin/egg.in_use')), ->tooltip(fn (Egg $egg): string => $egg->servers()->count() <= 0 ? trans('filament-actions::delete.single.label') : trans('admin/egg.in_use')),
ExportEggAction::make(), ExportEggAction::make(),
ImportEggAction::make() ImportEggAction::make()
->multiple(false), ->multiple(false)
->after(function () {
$this->record->refresh();
$this->refreshForm();
}),
Action::make('save') Action::make('save')
->hiddenLabel() ->hiddenLabel()
->action('save') ->action('save')
@@ -316,6 +320,8 @@ class EditEgg extends EditRecord
public function refreshForm(): void public function refreshForm(): void
{ {
$this->fillForm(); $this->fillForm();
$this->dispatch('setContent', content: $this->record->script_install ?? '');
} }
protected function getFormActions(): array protected function getFormActions(): array

View File

@@ -113,6 +113,7 @@ class EggImporterService
'uuid' => $uuid, 'uuid' => $uuid,
'author' => Arr::get($parsed, 'author'), 'author' => Arr::get($parsed, 'author'),
'copy_script_from' => null, 'copy_script_from' => null,
'config_from' => null,
]); ]);
for ($i = 0; $i < count($parsed['variables']); $i++) { for ($i = 0; $i < count($parsed['variables']); $i++) {