[BUGFIX] PG-2141: Keep row actions visible after pagination on Livewire 4.4.2+ - #2143
Open
aleRibeiro0209 wants to merge 1 commit into
Conversation
aleRibeiro0209
force-pushed
the
fix/PG-2141-actions-disappear-after-pagination
branch
from
September 18, 2026 21:56
33d27cf to
5265feb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
⚡ PowerGrid - Pull Request
Description
Fixes row action buttons disappearing after pagination (and any other Livewire
update, e.g. sort/search/filter) on Livewire 4.4.2+. The action column header
stays, but the buttons vanish from every row starting on page 2.
Root cause: in v6 the per-row actions are injected client-side.
dispatchActionsToJS()pushes the action HTML through$this->js('pgActions', …),which the
support-livewire-v4script stores in a globalwindow['pgActions_' + id].Each row renders them with
x-html="toHtml", andtoHtml()reads that global.Because the global is not an Alpine-reactive dependency,
x-htmlis evaluated onlyonce — when Alpine initializes the morphed node. Livewire 4.4.2 ("Close asynchronous
morph timing gaps") reordered the morph so Alpine now evaluates
toHtml()beforethe
$this->js('pgActions')effect refreshes the global. The stale global has noentry for the new page's row ids, so
toHtml()returns an empty string and thebuttons disappear.
Fix: re-render the actions once the fresh data lands, independent of the
morph / JS-effect ordering:
support-livewire-v4.blade.phpdispatches apg:actions-updatedwindow eventright after refreshing
window['pgActions_*']/window['pgActionsHeader_*'].pgRenderActionsgains a reactiverenderTickcounter, incremented by apg:actions-updatedlistener (registered ininit(), cleaned up indestroy()).toHtml()now readsrenderTick, so Alpine re-evaluates thex-htmlbinding assoon as the up-to-date action data is available.
Behavior is unchanged on the initial page load and on Livewire < 4.4.2 — the fix
only adds a re-render trigger that morph timing used to supply incidentally.
Example (unchanged usage, now correct across pages):
Files changed:
resources/js/components/pg-render-actions.jsresources/views/components/support-livewire-v4.blade.phpdist/powergrid.js(rebuilt bundle)Verified with a Livewire 4.4.5 + Tailwind reproduction (120 rows / 10 per page):
action buttons went from 20 → 0 on page 2 before the fix, and 20 → 20 after.
Related Issue(s):
Closes #2141
Documentation
This PR requires Documentation update?