Skip to content

[5.x] Admin table action buttons firing on render#19259

Open
nfourtythree wants to merge 1 commit into
5.xfrom
nathaniel/cms-2285-5x-vueadmintable-a-single-ajax-action-button-fires-its
Open

[5.x] Admin table action buttons firing on render#19259
nfourtythree wants to merge 1 commit into
5.xfrom
nathaniel/cms-2285-5x-vueadmintable-a-single-ajax-action-button-fires-its

Conversation

@nfourtythree

Copy link
Copy Markdown
Contributor

Description

Fix accidentally firing action buttons on admin tables

Related issues

#19255

@nfourtythree nfourtythree self-assigned this Jul 17, 2026
Copilot AI review requested due to automatic review settings July 17, 2026 10:14
@linear-code

linear-code Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

CMS-2285

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an issue in the Vue admin table action button component where an AJAX action could be executed during re-render (e.g., when selecting rows) because the click handler was invoked while binding the listener.

Changes:

  • Wrap the AJAX click handler in a function so it runs on user click rather than during render.
  • Adjust the button type binding to ensure non-menu buttons have an explicit type (submit for non-AJAX when enabled; otherwise button).
  • Add a Craft 5 changelog entry under “Unreleased” referencing the fix and linked issue.

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/craftcms-vue/admintable/components/AdminTableActionButton.vue Fixes the event binding so AJAX actions don’t fire during render; tweaks button type behavior.
CHANGELOG.md Documents the bugfix under the new “Unreleased” section with an issue link.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

enabled && !isMenuButton && ajax
? {click: handleClick(param, value, action, ajax, handleClick)}
? {
click: () => handleClick(param, value, action, ajax, handleClick),
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.

2 participants