[Issue] Do not send an ajax request if there no affected sections #31948
Labels
Issue: Confirmed
Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed
Priority: P1
Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing.
Progress: done
Reproduced on 2.4.x
The issue has been reproduced on latest 2.4-develop branch
Severity: S1
Affects critical data or functionality and forces users to employ a workaround.
Projects
This issue is automatically created based on existing pull request: #31933: Do not send an ajax request if there no affected sections
Description (*)
In the customer data, we have a handler for all ajax requests. If we have some custom JS that sends POST, PUT or DELETE request, it tries to send a request to the backend to reload affected sections. As we had such a request by some tracking - these requests caused an additional request to the backend on all the pages that caused a significant load to the servers.
In case if there are no affected sections, it is still sending requests to the backend.
We got this issue when we created a mixin to the
getAffectedSections
forMagento_Customer/js/section-config
and returning an empty array for our custom URL (request is sent not to Magento, so it can't affect any Magento sections).Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
getAffectedSections
method add following code in console:3. Open frontend
4. open developer tools, execute following JS:
Actual result:
![image](https://user-images.githubusercontent.com/1873745/106590767-20fd5c00-6556-11eb-8fe8-af0983aa46ec.png)
❌ request for reloading customer sections was sent to the backend
Expected result
![image](https://user-images.githubusercontent.com/1873745/106591127-8fdab500-6556-11eb-88be-76a40c0bdd14.png)
✔ request for reloading customer sections shouldn't be sent to the backend
Questions or comments
Contribution checklist (*)
The text was updated successfully, but these errors were encountered: