railsadminteam / rails_admin

RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data
MIT License
7.88k stars 2.25k forks source link

Clicking 'Cancel' on the delete confirm page still deletes the row. #3499

Closed wartron closed 2 years ago

wartron commented 2 years ago

Describe the bug When clicking the 'X' to delete item from the table view. On the confirm page clicking 'Cancel' on the delete confirm page still deletes the row.

Expected behavior Go back to the table view.

Additional context

codealchemy commented 2 years ago

I'm not able to reproduce this on https://github.com/railsadminteam/rails_admin/commit/8dfc51bb484ba8dde4d63da02dd2bfca3083c49f, any chance you could repro the issue in a fresh Rails app?

The following check should shortcut the delete action when 'Cancel' is clicked: https://github.com/railsadminteam/rails_admin/blob/8dfc51bb484ba8dde4d63da02dd2bfca3083c49f/app/controllers/rails_admin/main_controller.rb#L127-L131

wartron commented 2 years ago

I will try it with a fresh repo. But inspecting the cancel button it does have the name "_continue"

<button class="btn" data-disable-with="Cancel" name="_continue" type="submit">
      <i class="fas fa-times"></i>
      Cancel
    </button>
mshibuya commented 2 years ago

@wartron Do you use Webpacker? If so, what's the version of rails_admin npm package?

wartron commented 2 years ago

@mshibuya @codealchemy Thank for your help. Upgrading the npm package fixed my issue.