Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backward compatibility] Customer section load with one section causes an error #28154

Closed
zhartaunik opened this issue May 8, 2020 · 7 comments · Fixed by #29081
Closed

[Backward compatibility] Customer section load with one section causes an error #28154

zhartaunik opened this issue May 8, 2020 · 7 comments · Fixed by #29081
Assignees
Labels
Component: Customer Component: Multishipping Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Priority: P3 May be fixed according to the position in the backlog. Progress: done Reported on 2.3.5-p1 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.

Comments

@zhartaunik
Copy link
Contributor

zhartaunik commented May 8, 2020

Preconditions (*)

  1. Magento 2.4-develop
  2. It cannot be reproduced on clean Magento. An issue occurred only with incompatible code.

Steps to reproduce (*)

Open any page and take any action which force Magento to clean one section (In my case it was adding product to shopping cart from PDP)
Source code should contain sth like
customerData.reload('cart');
instead of
customerData.reload(['cart']);

Expected result (*)

The console log must be clear.

Actual result (*)

We faced with an issue in console:
customer-data.js:87 Uncaught Error: [object Object]
at Object. (customer-data.js:87)
at fire (jquery.js:3238)
at Object.fireWith [as rejectWith] (jquery.js:3368)
at done (jquery.js:9848)
at XMLHttpRequest.callback (jquery.js:10317)

Screenshot from 2020-09-16 14-42-31

What actually happens:

www/magento/vendor/magento/module-customer/view/frontend/web/js/section-config.js:61
Previous code:

        /**
         * @param {*} allSections
         * @return {*}
         */
        filterClientSideSections: function (allSections) {
            if (Array.isArray(allSections)) {
                return _.difference(allSections, clientSideSections);
            }

            return allSections;
        },

Magento 2.3.5-p1 code:

        /**
         * Filters the list of given sections to the ones defined as client side.
         * @param {Array} allSections - List of sections to check.
         * @return {Array} - List of filtered sections.
         */
        filterClientSideSections: function (allSections) {
            return _.difference(_.toArray(allSections), clientSideSections);
        },

When we pass into this function one element (string) JS parses as an array:

_.toArray(allSections)
(9) ["a", "u", "t", "h", "_", "d", "a", "t", "a"]

And of course cannot find such sections.

Upd 1.
Initially, your method accepted anything and we passed a string with a section name. Now your are accepting arrays only, but there no such verification in the method.
I suppose for backward compatibility you should return back isArray verification.

@m2-assistant
Copy link

m2-assistant bot commented May 8, 2020

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

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

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.

@zhartaunik do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label May 8, 2020
@zhartaunik zhartaunik changed the title Customer section load with one section causes an error [Backward compatibility] Customer section load with one section causes an error May 8, 2020
@kpitn
Copy link

kpitn commented May 25, 2020

I confirm the bug, is anyone upgrade to 2.3.5 ?

When cart section reload url is :
http://xxx/customer/section/load/?sections=c%2Cu%2Cs%2Ct%2Co%2Cm%2Ce%2Cr&_=1590406308206

(decode = http://xxxx/customer/section/load/?sections=c,u,s,t,o,m,e,r&_=1590406308206

@jonaschen623
Copy link

confirm bug, with version 2.3.5-p1

http://***/customer/section/load/?sections=w%2Ci%2Cs%2Ch%2Cl%2Ci%2Cs%2Ct&_=1594592363309

decode = http://***/customer/section/load/?sections=wishlist&_=1594592363309

@complexthings
Copy link

This happens when you get bad data in mage-cache-storage-section-invalidation in localStorage, usually triggered by a wildcard reload, which tries to load * as a section. I have a PR that kinda of addresses this: #29081

@ghost ghost assigned complexthings Aug 14, 2020
@ghost ghost added Progress: PR in progress Priority: P3 May be fixed according to the position in the backlog. and removed Progress: ready for QA labels Aug 14, 2020
@engcom-Alfa engcom-Alfa added Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. Component: Customer Component: Multishipping Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch labels Sep 22, 2020
@ghost ghost removed the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Sep 22, 2020
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @engcom-Alfa
Thank you for verifying the issue. Based on the provided information internal tickets MC-37811 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.

@magento-engcom-team magento-engcom-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: ready for dev and removed Progress: PR in progress labels Sep 22, 2020
@gabrieldagama gabrieldagama added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Sep 23, 2020
@magento-engcom-team magento-engcom-team added the Reported on 2.3.5-p1 Indicates original Magento version for the Issue report. label Nov 13, 2020
@knsalim
Copy link

knsalim commented Apr 1, 2021

@kpitn @jonaschen623

http://***/customer/section/load/?sections=w%2Ci%2Cs%2Ch%2Cl%2Ci%2Cs%2Ct&_=1594592363309

decode = http://***/customer/section/load/?sections=wishlist&_=1594592363309

for this issues i just removed the comma(under join) in customer-data.js the issues is fixed for me

before change
sections: sectionNames.join(',')

after change
sections: sectionNames.join('')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Customer Component: Multishipping Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Priority: P3 May be fixed according to the position in the backlog. Progress: done Reported on 2.3.5-p1 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

8 participants