Skip to content

mixins for priceBox::reloadPrice not working consistently accross browsers #35097

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

Closed
1 of 5 tasks
ioweb-gr opened this issue Feb 14, 2022 · 13 comments
Closed
1 of 5 tasks
Assignees
Labels
Area: Frontend Issue: needs update Additional information is require, waiting for response Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@ioweb-gr
Copy link
Contributor

ioweb-gr commented Feb 14, 2022

Preconditions (*)

  1. Magento 2.4.3-p1
  2. Firefox 97/98

Steps to reproduce (*)

Create a module and add the following file

app/code/Vendor/Module/view/frontend/requirejs-config.js

var config = {
    config:
        {
            mixins: {
                'Magento_Catalog/js/price-box':
                    {
                        'Vendor_Module/js/price-box-mixin': true
                    }
            }
        }
};

Follow the documentation to add a mixin for reloadPrice

app/code/Vendor/Module/view/frontend/web/js/price-box-mixin.js

define([
    'jquery',
    'mage/utils/wrapper',
    'jquery/ui',
], function ($, wrapper) {
    'use strict';

    var widgetMixin = {
        reloadPrice: function () {
            console.log('mixin reload price1');
            return this._super();
        }
    };

    return function (targetWidget) {
        // Example how to extend a widget by mixin object
        $.widget('mage.priceBox', targetWidget, widgetMixin); // the widget alias should be like for the target widget

        return $.mage.priceBox; //  the widget by parent alias should be returned
    };
});

It seems the same behaviour is happening for klarma pricebox-widget-mixin.js

To make an easier example, I added a console.error in klarma mixin as well.

Expected result (*)

  1. The mixin is always executed like in Chrome
    image

Actual result (*)

  1. The mixin is not executed in firefox or randomly executes as you can see in console.log neither for the custom module nor for klarma mixin
    image

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

  • 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”.
@m2-assistant
Copy link

m2-assistant bot commented Feb 14, 2022

Hi @ioweb-gr. Thank you for your report.
To speed up processing of this issue, make sure that you provided the following information:

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

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

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

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

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

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

@ioweb-gr ioweb-gr changed the title mixins for priceBox::reloadPrice not working consistently mixins for priceBox::reloadPrice not working consistently accross browsers Feb 14, 2022
@engcom-Delta engcom-Delta self-assigned this Feb 16, 2022
@m2-assistant
Copy link

m2-assistant bot commented Feb 16, 2022

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

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Delta
Copy link
Contributor

Hi @ioweb-gr ,

Thank you for reporting an issue . Kindly provide more clarity on which documentation we should refer please?
"Follow the documentation to add a mixin for reloadPrice"

Hence, added the label 'Needs Update'.

Thanks

@engcom-Delta engcom-Delta added Issue: needs update Additional information is require, waiting for response Area: Frontend and removed Issue: ready for confirmation labels Feb 17, 2022
@ioweb-gr
Copy link
Contributor Author

ioweb-gr commented Feb 17, 2022

@engcom-Delta
Copy link
Contributor

Hi @ioweb-gr ,
Thanks for confirming the document.

@engcom-Delta engcom-Delta added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Feb 21, 2022
@engcom-Delta engcom-Delta removed their assignment Feb 23, 2022
@engcom-Delta engcom-Delta removed the Issue: needs update Additional information is require, waiting for response label Feb 23, 2022
@engcom-Echo
Copy link
Contributor

engcom-Echo commented Jul 22, 2022

Hello @ioweb-gr,

Thanks for you contribution and collaboration.
We have tried to reproduce this issue on magento 2.4-develop branch but it is not able to reproduce.

followed steps.
1.Create a magento module.
2.app/code/Vendor/Module/view/frontend/requirejs-config.js

var config = {
    config:
        {
            mixins: {
                'Magento_Catalog/js/price-box':
                    {
                        'Vendor_Module/js/price-box-mixin': true
                    }
            }
        }
};
  1. app/code/Vendor/Module/view/frontend/web/js/price-box-mixin.js
define([
    'jquery',
    'mage/utils/wrapper',
    'jquery/ui',
], function ($, wrapper) {
    'use strict';

    var widgetMixin = {
        reloadPrice: function () {
            console.log('mixin reload price1');
            return this._super();
        }
    };

    return function (targetWidget) {
        // Example how to extend a widget by mixin object
        $.widget('mage.priceBox', targetWidget, widgetMixin); // the widget alias should be like for the target widget

        return $.mage.priceBox; //  the widget by parent alias should be returned
    };
});

  1. Run the command

    php bin/magento cache:clean

  2. Go to front end and click on product check in console.

Please find the attached screen for your reference.
firefox version 97

image

Chrome version
image

Please check if i missed anything and kindly check on magento 2.4-develop branch and provide more information so that we can reproduce this issue.

Thanks

@engcom-Echo engcom-Echo added the Issue: needs update Additional information is require, waiting for response label Jul 22, 2022
@m2-assistant
Copy link

m2-assistant bot commented Jul 29, 2022

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

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
      DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
    1. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

@engcom-Echo
Copy link
Contributor

Hello @ioweb-gr,

We have noticed that this issue has not been updated for a period of 14 Days.
Hence we assume that this issue is fixed now, so we are closing it.Please raise a fresh ticket or reopen this ticket if you need more assistance on this.

Thanks

@amenk
Copy link
Contributor

amenk commented Mar 15, 2023

@engcom-Echo When reproducing, how many times did you reload? The OP states that this happens randomly, so at least the page should be Ctrl+Shift+F5 reloaded 10 times or so I think and it should be checked if it always loads.
We have a similar problem in 2.4.5 and seek for a solution in https://magento.stackexchange.com/questions/354911/magento-2-4-3-js-mixin-file-not-loading-on-each-page-load

@jorgehs91
Copy link

Important to note that I faced the same issue, but only reproducible with a bad connection. So changing the network speed at the developer tools could help to replicate the issue.

@ioweb-gr
Copy link
Contributor Author

Try this one out

https://github.com/magento/magento2/pull/39097/files

It helped us

@jorgehs91
Copy link

Thanks @ioweb-gr. It fixed the issue.

@ioweb-gr
Copy link
Contributor Author

Unfortunately the person who started the PR doesn't seem to be available to sync it with the main branch so it doesn't get merged on live. We'll need at some point to take his code, merge it in the branch and start a new PR for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Frontend Issue: needs update Additional information is require, waiting for response Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
None yet
Development

No branches or pull requests

5 participants