Skip to content

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

Open
wu-zuan wants to merge 12 commits into
pelican-dev:mainfrom
wu-zuan:main
Open

fix: Egg edit form not refreshing after import or update#2358
wu-zuan wants to merge 12 commits into
pelican-dev:mainfrom
wu-zuan:main

Conversation

@wu-zuan
Copy link
Copy Markdown

@wu-zuan wu-zuan commented May 26, 2026

Description

This PR fixes the issue where the Egg edit form fails to reflect changes immediately after an import or update action. Previously, the form displayed stale data, and the Monaco editor did not sync its content until a full page reload.

Changes

  • Livewire Refresh: Injected $livewire into UpdateEggAction and ImportEggAction to trigger refreshForm() upon successful execution.
  • Editor Sync: Added a setContent event dispatch in EditEgg.php to force the Monaco editor to update its display content.
  • Config Reset: Explicitly set config_from to null in EggImporterService during import/reset to prevent residual configuration data.

Testing

  • Modified script_install and config_files for an existing Egg.
  • Verified that the form fields and the Monaco editor update instantly after clicking the Update/Import button without a page reload.

Related Issue

Fixes #2344

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

EditEgg.refreshForm() now dispatches a Livewire setContent event to sync the Monaco editor; ImportEggAction and UpdateEggAction accept the Livewire component and call refreshForm() after updating the record when available; EggImporterService sets config_from => null on imported eggs.

Changes

Egg Form Refresh After Import and Update

Layer / File(s) Summary
Form refresh mechanism with editor content sync
app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php
EditEgg::refreshForm() fills the form then dispatches setContent with the record's script_install (or empty string) to synchronize the Monaco editor; several closure formatting edits present.
Import action handler refresh integration
app/Filament/Components/Actions/ImportEggAction.php
Import action closure now accepts a $livewire parameter and, after the import notification, conditionally refreshes the Livewire record and calls refreshForm() if available.
Update action handler refresh integration
app/Filament/Components/Actions/UpdateEggAction.php
Update action closure now accepts a typed $livewire (Livewire\Component) and, after success notification, conditionally refreshes the Livewire record and calls refreshForm() if available.
Importer service egg data state
app/Services/Eggs/Sharing/EggImporterService.php
EggImporterService::fromParsed() includes config_from => null in the forceFill() payload when importing an Egg.

Possibly related PRs

  • pelican-dev/panel#1947: Also modifies EggImporterService::fromParsed(), related to importer behavior and state handling.
  • pelican-dev/panel#2042: Related Livewire action closure and EditEgg.php changes touching action handlers and notifications.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change—fixing the egg edit form to refresh after import or update actions.
Description check ✅ Passed The description clearly explains the problem, lists specific changes made, includes testing verification, and references the related issue.
Linked Issues check ✅ Passed All objectives from issue #2344 are met: fillForm() is called via refreshForm() in actions, Monaco editor receives setContent event, and config_from is reset to null.
Out of Scope Changes check ✅ Passed All code changes are directly related to fixing form refresh and editor sync issues described in the linked issue; no out-of-scope modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/Filament/Components/Actions/UpdateEggAction.php`:
- Line 62: Before calling $livewire->refreshForm() in UpdateEggAction, refresh
the model to avoid stale in-memory and relationship-backed data: call
$this->record->refresh() (or $record->refresh() if that's the local variable)
prior to $livewire->refreshForm(). Mirror the pattern used in ImportEggAction
(which calls record->refresh()) so the update flow repopulates the form from the
persisted, up-to-date model state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7a80a0ee-97a4-4bf1-9cb6-87ecaf275cbe

📥 Commits

Reviewing files that changed from the base of the PR and between 13bb47e and c630b6d.

📒 Files selected for processing (4)
  • app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php
  • app/Filament/Components/Actions/ImportEggAction.php
  • app/Filament/Components/Actions/UpdateEggAction.php
  • app/Services/Eggs/Sharing/EggImporterService.php

Comment thread app/Filament/Components/Actions/UpdateEggAction.php Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 26, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@wu-zuan
Copy link
Copy Markdown
Author

wu-zuan commented May 26, 2026

I have read the CLA Document and I hereby sign the CLA

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php`:
- Around line 50-51: The #[Override] attribute on the EditEgg page's property
should be removed because #[Override] for properties isn't supported before PHP
8.5; edit the EditEgg class and delete the #[Override] annotation from the
public ?Egg $record = null; declaration (leave the property and its type
nullable Egg intact) so the code remains compatible with PHP 8.3/8.4.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 50f73697-0e40-4817-ab41-cef2b44c7970

📥 Commits

Reviewing files that changed from the base of the PR and between f6e4d18 and 4db5a7d.

📒 Files selected for processing (1)
  • app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php

Comment thread app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php Outdated
Comment thread app/Filament/Admin/Resources/Eggs/Pages/EditEgg.php Outdated
Comment thread app/Filament/Components/Actions/ImportEggAction.php Outdated
Comment thread app/Filament/Components/Actions/ImportEggAction.php Outdated
… and remove redundant property definition from EditEgg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Egg edit form does not refresh after import or update

2 participants