Description
Preconditions and environment
- Magento version: 2.4.7-p2, tested on both community and enterprise editions
- PHP 8.3
For testing purposes, 7 inventory sources were added manually, making the total amount of sources be 8:
Each of them had identical settings:
Steps to reproduce
- Create a new product. For example, have the name and SKU be "test_1" and price set to $1. Assign the first two sources to the product and save it.
This is the source assignment that is expected after saving:
- Click "Assign Sources"
- Check any three checkboxes. The result will be as expected - 3 checked checkboxes.
- Check one more checkbox - pick any of the remaining checkboxes.
Expected result
4 checkboxes should be checked after checking the 4th checkbox.
Actual result
All checkboxes are checked. This is the issue.
This issue forces users to employ the workaround of unchecking the newly checked checkboxes.
If all the three newly checkboxes are unchecked afterwards and a fourth one is to be checked again, the issue no longer occurs. However, the issue does occur again if the user clicks "Cancel" and re-opens the "Assign Sources" dialog.
Additional information
No console errors or warnings appear while reproducing this issue.
Screenshots are from Magento 2.4.7-p2 community edition installed with composer with no customizations or additional modules.
The root of the issue appears to be that already selected sources are passed to the "selected" observable in multiselect.js, leading to the wrong assumption 6 records are selected instead of 4 after the 4th checkbox is checked, leading to a selectAll call in the updateState function.
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.