Skip to content

[BUGFIX] PG-2141: Keep row actions visible after pagination on Livewire 4.4.2+ - #2143

Open
aleRibeiro0209 wants to merge 1 commit into
Power-Components:6.xfrom
aleRibeiro0209:fix/PG-2141-actions-disappear-after-pagination
Open

aleRibeiro0209 wants to merge 1 commit into
Power-Components:6.xfrom
aleRibeiro0209:fix/PG-2141-actions-disappear-after-pagination

Conversation

@aleRibeiro0209

Copy link
Copy Markdown
Contributor

⚡ PowerGrid - Pull Request

  • Bug fix
  • Enhancement
  • New feature
  • Breaking change

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-v4 script stores in a global window['pgActions_' + id].
Each row renders them with x-html="toHtml", and toHtml() reads that global.
Because the global is not an Alpine-reactive dependency, x-html is evaluated only
once — when Alpine initializes the morphed node. Livewire 4.4.2 ("Close asynchronous
morph timing gaps") reordered the morph so Alpine now evaluates toHtml() before
the $this->js('pgActions') effect refreshes the global. The stale global has no
entry for the new page's row ids, so toHtml() returns an empty string and the
buttons disappear.

Fix: re-render the actions once the fresh data lands, independent of the
morph / JS-effect ordering:

  • support-livewire-v4.blade.php dispatches a pg:actions-updated window event
    right after refreshing window['pgActions_*'] / window['pgActionsHeader_*'].
  • pgRenderActions gains a reactive renderTick counter, incremented by a
    pg:actions-updated listener (registered in init(), cleaned up in destroy()).
    toHtml() now reads renderTick, so Alpine re-evaluates the x-html binding as
    soon 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):

public function actions(Dish $row): array
{
    return [
        Button::add('edit')->slot('Edit')->dispatch('edit', ['rowId' => $row->id]),
        Button::add('delete')->slot('Delete')->dispatch('delete', ['rowId' => $row->id]),
    ];
}

Files changed:

  • resources/js/components/pg-render-actions.js
  • resources/views/components/support-livewire-v4.blade.php
  • dist/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?

  • Yes
  • No
  • I have already submitted a Documentation pull request.

@aleRibeiro0209
aleRibeiro0209 changed the base branch from 7.x to 6.x September 18, 2026 21:25
@aleRibeiro0209 aleRibeiro0209 changed the title fix: keep row actions visible after pagination on Livewire 4.4.2+ (#2… [BUGFIX] PG-2141: Keep row actions visible after pagination on Livewire 4.4.2+ (#2… Sep 18, 2026
@aleRibeiro0209 aleRibeiro0209 changed the title [BUGFIX] PG-2141: Keep row actions visible after pagination on Livewire 4.4.2+ (#2… [BUGFIX] PG-2141: Keep row actions visible after pagination on Livewire 4.4.2+ Sep 18, 2026
@aleRibeiro0209
aleRibeiro0209 force-pushed the fix/PG-2141-actions-disappear-after-pagination branch from 33d27cf to 5265feb Compare September 18, 2026 21:56
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.

[6.x] Actions disappear after pagination with Livewire 4.4.2 +

1 participant