magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.49k stars 9.29k forks source link

Checkbox selection bug in product inventory source assignment: multiple checkboxes selected unexpectedly #39179

Open edvardsr opened 6 days ago

edvardsr commented 6 days ago

Preconditions and environment

For testing purposes, 7 inventory sources were added manually, making the total amount of sources be 8: image

Each of them had identical settings: image

Steps to reproduce

This is the source assignment that is expected after saving:

image

image

Expected result

4 checkboxes should be checked after checking the 4th checkbox.

Actual result

All checkboxes are checked. This is the issue.

image

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

m2-assistant[bot] commented 6 days ago

Hi @edvardsr. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

m2-assistant[bot] commented 6 days ago

Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down: