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.56k stars 9.32k forks source link

Dynamic Rows - deleteValue/deleteProperty not used on deleting records #29574

Open gwharton opened 4 years ago

gwharton commented 4 years ago

Magento Docs state the following for dynamic rows config

deleteProperty The property added to a record data object when the record is deleted. Applied if the deleteValue option is enabled.

deleteValue Adds the deleteProperty property in the data object for the deleted record.

If I create a dynamic rows instance and set deleteValue to true and deleteProperty to "delete". When I delete a record, and save the record set, I would expect the controller to receive a data set including the deleted row, but with the deleted row marked with "delete" so the controller can easily see a deleted record and handle the removal.

I am not seeing this behaviour.

Preconditions (*)

  1. 2.4-develop

Steps to reproduce (*)

  1. Install test module (attached to issue)
  2. Go to the following page https://<host>/admin/testdynamicrows/test/index/entity_id/1 image
  3. Click save without modifying data. The data passed to the save handler is displayed image
  4. Go back to https://<host>/admin/testdynamicrows/test/index/entity_id/1
  5. Remove row from data set.
  6. Click save.

Expected result (*)

  1. Data passed to save controller includes both records, but the record that was deleted is marked as deleted due to deleteValue being set true.

Actual result (*)

  1. Only 1 record is passed to save controller. image

Proof of concept Module attached here. testdynamicrows.zip


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

m2-assistant[bot] commented 4 years ago

Hi @gwharton. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

gwharton commented 4 years ago

If I run the test module on 2.1.18 (updated version of proof of concept module that works on 2.1.18 attached) then it works as expected. In this example, I have removed the second row and saved.

image

app.zip

It appears to have stopped working in 2.2.0, from this commit. https://github.com/magento/magento2/commit/d5f0dd2e5647c29f840efc1c03741b0e9b4f2c57

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

gwharton commented 3 years ago

Not stale

m2-assistant[bot] commented 3 years ago

Hi @engcom-Alfa. 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:

engcom-Alfa commented 3 years ago

@gwharton . The issue is still reproducible on fresh 2.4-develop.

Steps to reproduce:

  1. Install test module testdynamicrows.zip
  2. Go to the following page https://<host>/admin/testdynamicrows/test/index/entity_id/1 Screenshot from 2021-01-29 13-09-06
  3. Click save without modifying data. The data passed to the save handler is displayed {"post_data":{"testdynamicrows":{"testdynamicrows":[{"entity_id":"1","data_field":"Data Field 1","initialize":"true","record_id":"0"},{"entity_id":"2","data_field":"Data Field 2","initialize":"true","record_id":"1"}]},"form_key":"mDiYNxe68AaH4t3S"}}
  4. Go back to https://<host>/admin/testdynamicrows/test/index/entity_id/1
  5. Remove row from data set.
  6. Click save.

Actual Result: :x: Only 1 record is passed to save controller. {"post_data":{"testdynamicrows":{"testdynamicrows":[{"entity_id":"2","data_field":"Data Field 2","initialize":"true","record_id":"1"}]},"form_key":"mDiYNxe68AaH4t3S"}}

Note: 2021-01-29_13-13

magento-engcom-team commented 3 years ago

:white_check_mark: Confirmed by @engcom-Alfa Thank you for verifying the issue. Based on the provided information internal tickets MC-40680 were created

Issue Available: @engcom-Alfa, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

magento-engcom-team commented 3 years ago

Unfortunately, we are archiving this ticket now as it did not get much attention from both Magento Community and Core developers for an extended period. This is done in an effort to create a quality, community-driven backlog which will allow us to allocate the required attention more easily.

Please feel free to comment or reopen according to the Issue reporting guidelines the ticket if you are still facing this issue on the latest 2.x-develop branch. Thank you for collaboration.

m2-assistant[bot] commented 3 years ago

Hi @Den4ik. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:


magento-engcom-team commented 3 years ago

@Den4ik Thank you for verifying the issue.

Unfortunately, not enough information was provided to acknowledge ticket. Please consider adding the following:

Once all required information is added, please add label "Issue: Confirmed" again. Thanks!

Den4ik commented 3 years ago

I think we should increase Priority and Severity to P2 and S2 because issue affect to user experience

cc @sdzhepa @gabrieldagama

magento-engcom-team commented 3 years ago

:white_check_mark: Confirmed by @Den4ik Thank you for verifying the issue. Based on the provided information internal tickets MC-40680 were created

Issue Available: @Den4ik, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

sidolov commented 3 years ago

@Den4ik could you please clarify how user experience is affected? I believe it's related to developer's experience and how developer will handle changes provided by the user.

gwharton commented 3 years ago

In my view the bug in the dynamicRows component was introduced in 2.2.0. I suspect that the resulting bugs introduced into magento as a result of this change (any magento functionality that used the deleteValue attribute in dynamic rows would have stopped working) and was probably fixed on a case by case basis, by introducing logic to detect the deleted results and handle them, instead of fixing the underlying problem of the deleteValue functionality being broken.

Workarounds for the broken functionality were obviously introduced wherever they were needed during 2.2 and 2.3. There is currently no core functionality (that I am aware of) that is currently broken that uses the deleteProperty function of the dynamic rows component.

It is also likely that any third party developers also saw the unintended breaking change in 2.2 and implemented their own workarounds which are still in place.

The underlying deleteValue functionality remains broken though and still does not operate as the documentation suggests it should. You could just update the documentation to remove the "deleteProperty", "deleteValue" entries so code developers aren't trying to use this functionality that is broken (and hasnt worked since 2.2), introducing a note to say developers need to detect deleted rows on their own.

The deleteValue functionality is seriously useful though, as without it, you need to compare the before dataset, with the after dataset to determine any rows that have disappeared, whereas with the existing deleteValue functionality working, you are provided with a list of records that were deleted which is much more memory efficient.

It is broken because of an unintended change in the code, as highlighted above, and not because the code to implement it was removed. It was an unintended consequence of another change, and the code for deleteValue functionality is still there, just presently bypassed.

Den4ik commented 3 years ago

@sidolov I agree with @gwharton. I didn't check but I believe that this properties worked before and in this case all custom modules that use this properties currently provide unexpected result if they are not updated. In my opinion we should fix it as soon as possible and provide fix in patch release.

gwharton commented 3 years ago

It's been broken since 2.2. I think most third parties will have worked around it by now 😀 been broken for so long, probs easier to remove it from the docs instead of fixing it. It would be useful if it worked though.

Den4ik commented 3 years ago

@gwharton 😄 In this case we can just update documentation for each bug. I'm still thought that fix bug and adding tests for this case is the best solution. I hope some one from community or I'll have time for take it into progress in the near future.

adamlavery commented 2 years ago

Can't quite believe what I've read here but explains why UI component implementation is so poorly done and hit and miss. Someone makes a change, doesn't test it properly and it results in breaking documented functionality that others may rely on. And you're joking about leaving it broken and just removing from the docs? Unprofessional! No wonder Magento is falling apart.

gwharton commented 2 years ago

The point I made about removing it from the docs was.made with tongue in cheek. Hoping it may have shamed Magento Into action. Alas no.

adamlavery commented 2 years ago

Ok. The correct approach here is to push this back to whoever broke it and request that they reimplement their change, this time testing it properly.

Poovarasan-06 commented 1 year ago

@magento I am working on this

Poovarasan-06 commented 1 year ago

@magento give me 2.1.18 instance

magento-deployment-service[bot] commented 1 year ago

Hi @Poovarasan-06. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @Poovarasan-06, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.