Skip to content

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

Open
@edvardsr

Description

@edvardsr

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:
image

Each of them had identical settings:
image

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:

image

  • Click "Assign Sources"
  • Check any three checkboxes. The result will be as expected - 3 checked checkboxes.

image

  • 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.

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

  • 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”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: ProductComponent: InventoryIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReported on 2.4.7-p2Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions