Conversation
Add wire:poll.visible.15s to the alert banner container so new alerts are picked up without requiring a manual page refresh.
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughNew AlertBannerCollection class extends Filament's collection type with a static fromLivewire method. AlertBannerContainer updated to use this collection. AlertBanner.send() now flags Livewire-originated banners in session data. Livewire dehydration hook timing changed from standard listener to pre-hook. Changes
🚥 Pre-merge checks | ✅ 4 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (4 passed)
✏️ 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. Comment |
Boy132
left a comment
There was a problem hiding this comment.
Still requires a page refresh.
wire:poll alone only re-renders without pulling new banners from the session. Specify pullFromSession as the poll method so new alert banners are picked up without a page refresh.
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
Session-based polling doesn't work because nothing replenishes session data during poll requests. Instead, listen for Livewire's navigated event to re-pull session data after SPA page transitions, which catches banners pushed by the new page's mount lifecycle.
changed fix completely, need re-review
Boy132
left a comment
There was a problem hiding this comment.
Still doesn't work, tested with Console & Files page.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@app/Providers/Filament/FilamentServiceProvider.php`:
- Line 37: Remove the invalid import "use function Livewire\before;" and any
calls to before('dehydrate', ...) in FilamentServiceProvider; instead implement
the dehydrate() lifecycle method on the relevant Livewire component classes (or
use Livewire.hook('commit.prepare', ...) for client-side behavior) so code that
must run before dehydration lives in the component's dehydrate() method (or
appropriate JS hook) rather than relying on a nonexistent global before()
helper.
| use Livewire\Livewire; | ||
|
|
||
| use function Livewire\on; | ||
| use function Livewire\before; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat composer.json | jq '.require | to_entries[] | select(.key | contains("livewire"))'Repository: pelican-dev/panel
Length of output: 43
🏁 Script executed:
cat -n app/Providers/Filament/FilamentServiceProvider.php | sed -n '30,45p;70,85p'Repository: pelican-dev/panel
Length of output: 1114
🏁 Script executed:
# Search for Livewire\before in common hook-related files
rg -n "before\(" --type php | grep -i livewire | head -20Repository: pelican-dev/panel
Length of output: 43
🏁 Script executed:
# Check if Livewire has before as a documented hook
web_search Livewire before hook function dehydrateRepository: pelican-dev/panel
Length of output: 111
🏁 Script executed:
find . -name "composer.lock" -o -name "composer.json" | head -5Repository: pelican-dev/panel
Length of output: 92
🏁 Script executed:
cat composer.json 2>/dev/null | grep -A 2 -B 2 "livewire"Repository: pelican-dev/panel
Length of output: 234
🏁 Script executed:
# Search for any 'on(' or 'before(' usage in the codebase to understand the pattern
rg -n "Livewire\\\before|function before\(" --type php -A 3Repository: pelican-dev/panel
Length of output: 2056
🏁 Script executed:
# Check vendor directory or any evidence of Livewire package
find . -type d -name "livewire" 2>/dev/null | head -5Repository: pelican-dev/panel
Length of output: 87
🏁 Script executed:
cat composer.json | grep -A 20 '"require":'Repository: pelican-dev/panel
Length of output: 783
🏁 Script executed:
# Get Livewire version from composer.lock
cat composer.lock | jq '.packages[] | select(.name == "livewire/livewire") | {name, version, source}'Repository: pelican-dev/panel
Length of output: 270
🏁 Script executed:
# Also check require-dev for Livewire
cat composer.lock | jq '.packages[] | select(.name | contains("livewire")) | {name, version}'Repository: pelican-dev/panel
Length of output: 189
🌐 Web query:
Livewire v3 before hook lifecycle function dehydrate
💡 Result:
In Livewire v3, there isn’t a separate “beforeDehydrate”/“dehydrating” lifecycle hook. The dehydrate() method itself is the hook that runs at the end of every component request (i.e., your last chance to change component state before it’s serialized and sent back). [1]
If what you mean by “before dehydrate()” is “the hook that runs immediately prior in the request,” then the relevant render-phase hooks are:
rendering()→ runs beforerender()rendered()→ runs afterrender()dehydrate()→ runs at the end of the request [1]
If you’re using Volt, you can also register a dehydrate hook via dehydrate(fn () => ...), and Volt supports targeting specific properties via dehydrate(['count' => fn () => ...]). [2]
Sources:
[1] Livewire v3 Lifecycle Hooks (official docs)
[2] Livewire v3 Volt docs (lifecycle hooks)
🌐 Web query:
Livewire 3.7.6 before() function documentation
💡 Result:
Livewire 3.7.6 doesn’t have a documented component lifecycle hook named before(). In Livewire v3, the “before” equivalents are specific lifecycle hooks such as:
- Before a property updates:
updating()(andupdatingFoo()for a specific property) (livewire.laravel.com) - Before render():
rendering()(livewire.laravel.com) - Before an update request finishes: use JavaScript hooks like
Livewire.hook('commit.prepare', ...)(runs right before a request is sent) (livewire.laravel.com)
If you share where you’re calling before() (PHP component? JS? testing?), I can point you to the exact v3 API that matches what you’re trying to do.
Citations:
- 1: https://livewire.laravel.com/docs/lifecycle-hooks?utm_source=openai
- 2: https://livewire.laravel.com/docs/lifecycle-hooks?utm_source=openai
- 3: https://livewire.laravel.com/docs/3.x/javascript?utm_source=openai
🌐 Web query:
Livewire 3 global before() helper function hooks
💡 Result:
Livewire 3 doesn’t have a “global before() helper” for components. The equivalents are:
- Server-side (per component): use lifecycle hook methods like
boot(),hydrate(),updating(),rendering(),dehydrate(), etc. to run code before/after key phases. [1] - Client-side (global, before requests/updates): register JavaScript hooks with
Livewire.hook(...). For “before anything is sent”, usecommit.prepare(before commit payloads are collected/sent) orrequest(before the network request). [2]
Example (global JS “before send”):
document.addEventListener('livewire:init', () => {
Livewire.hook('commit.prepare', ({ component }) => {
// runs right before the request is prepared/sent
})
Livewire.hook('request', ({ url, options, payload, respond, succeed, fail }) => {
// runs before the network request
})
})Sources: lifecycle hooks [1], JS hooks including commit.prepare and request [2].
[1] https://livewire.laravel.com/docs/lifecycle-hooks
[2] https://livewire.laravel.com/docs/3.x/javascript
🏁 Script executed:
# Search for any function definition of 'before' in the codebase
rg "^\s*function before\(" --type phpRepository: pelican-dev/panel
Length of output: 43
🏁 Script executed:
# Search for where 'before' might be imported or defined
rg "def.*before|function.*before" --type php | grep -v Policy | grep -v "^Binary"Repository: pelican-dev/panel
Length of output: 560
🏁 Script executed:
# Check if there's any Livewire hook registration for 'before'
rg "register.*hook|Livewire::.*hook" --type php -A 2Repository: pelican-dev/panel
Length of output: 43
🏁 Script executed:
# Check if there's a custom Livewire service provider that might define before()
rg "before.*=|before\s*\(|register.*before" app/Providers --type php -B 2 -A 2Repository: pelican-dev/panel
Length of output: 789
🏁 Script executed:
# Check Filament's Livewire integration
rg "use.*Livewire|Livewire::" app/Providers/Filament/FilamentServiceProvider.php -A 2 -B 2Repository: pelican-dev/panel
Length of output: 454
Livewire\before() does not exist in Livewire v3.7.6 and will fail at runtime.
The before('dehydrate', ...) function call is not a valid Livewire v3 API. Livewire v3 provides lifecycle hooks like rendering(), rendered(), and dehydrate() as component methods, but does not expose a global before() helper function.
To run code before dehydration, use the dehydrate() lifecycle hook method directly in your component class, or use Livewire's JavaScript hooks like Livewire.hook('commit.prepare', ...) for client-side logic.
Also applies to: 77-77
🤖 Prompt for AI Agents
In `@app/Providers/Filament/FilamentServiceProvider.php` at line 37, Remove the
invalid import "use function Livewire\before;" and any calls to
before('dehydrate', ...) in FilamentServiceProvider; instead implement the
dehydrate() lifecycle method on the relevant Livewire component classes (or use
Livewire.hook('commit.prepare', ...) for client-side behavior) so code that must
run before dehydration lives in the component's dehydrate() method (or
appropriate JS hook) rather than relying on a nonexistent global before()
helper.
Fixed hydration issues... which resolves #1492
tested with: