Improve insurance integration stability & prevent unnecessary reloading of widget #591
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reason for change
In some versions of PrestaShop (here, 1.7.2.4), the insurance widget is reloaded in an infinite loop:
Enregistrement.de.l.ecran.2024-10-23.a.21.16.35.mov
In some other versions (e.g. 1.7.0.6) the reloading only inexplicably happens once instead of infinitely, i.e. 2 consecutive loading of the widget, so 1 extra load.
The root cause for both seems to be the use of PrestaShop events paired with messaging management from the widget iframe.
As a side effect, the whole product details & add to cart section of the product page is reloaded unnecessarily, including our BNPL widget, which makes the sidebar's height jump up & down.
Fixes ECOM-2184
Code changes
How to test
As a reviewer, you are encouraged to test the PR locally.
Before making the present changes, I noted different behaviours/bugs depending on different PS versions:
With this PR, the integration should behave the same in all versions and the following issues should not be visible anymore:
Checklist for authors and reviewers
Non applicable