Incorrect Action scope on Resources with non-numerical primary key #5515
-
Description:When running an action to item(s) selected, the action is executed on all items (including all pages) instead of running only on the selected items. This issue occurs specifically with resources that have a non-numerical primary key. Detailed steps to reproduce the issue on a fresh Nova installation:
Observed Behavior:The action is executed twice: first affecting 200 rows, and then affecting the remaining 13 rows. Expected Behavior:The action should be executed only for the N selected items. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
Unable to reproduce the issue, please provide full reproducing repository based on fresh installation as suggested in the bug report template (or you can refer to https://github.com/nova-issues for example) |
Beta Was this translation helpful? Give feedback.
-
|
Thank you @crynobone The main difference with your test is that the new resource does not use the |
Beta Was this translation helpful? Give feedback.
-
|
You should disable Action Logs if you only have few tables with such usage: https://nova.laravel.com/docs/4.0/actions/defining-actions.html#disabling-the-action-log |
Beta Was this translation helpful? Give feedback.
-
|
The problem was in the Eloquent model, the primary key had to be defined as a 'string' as stated in the Laravel documentation: https://laravel.com/docs/9.x/eloquent#primary-keys Simply adding Thanks for your time! |
Beta Was this translation helpful? Give feedback.
The problem was in the Eloquent model, the primary key had to be defined as a 'string' as stated in the Laravel documentation: https://laravel.com/docs/9.x/eloquent#primary-keys
Simply adding
protected $keyType = 'string';fixed the problem, no other change on our codebase was needed.Thanks for your time!