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

Mixins js do not appear when we open product links in a new tab #29694

Closed
1 of 5 tasks
Mecalux-Developer opened this issue Aug 20, 2020 · 11 comments
Closed
1 of 5 tasks
Assignees
Labels
Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Progress: done Reported on 2.3.4-p2 Indicates original Magento version for the Issue report. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@Mecalux-Developer
Copy link

Mecalux-Developer commented Aug 20, 2020

Preconditions (*)

  1. Our ecommerce: Magento 2.3.4-p2
  2. php version: 7.3.16
  3. Database: Mysql 5.7
  4. Varnish: 6.2.3
  5. Elasticsearch: 6.8.7
  6. Redis: 5.0.4
  7. Apache: 2.4.6
  8. Our website: https://www.shelvingdirect.com/

Steps to reproduce (*)

  1. Create a mixin of some file on the product page. For example, override some method of the Magento_Catalog/js/price-box.js module
  2. Go to the homepage of Magento
  3. Move the mouse over a product. Right-click and click "open the page in a new tab" for several products in the homepage

image

Expected result (*)

  1. We must see the mixin of price-box-mixin.min.js

image

  1. The mixin file appears when we click directly on the product instead of the right button and open the link in a new tab

Actual result (*)

  1. We see the price-box.min.js .The file price-box-mixin.min.js doesn't appear

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 Aug 20, 2020

Hi @Mecalux-Developer. 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.

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


⚠️ 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, please join the Community Contributions Triage session to discuss the appropriate ticket.

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

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

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Aug 20, 2020
@Mecalux-Developer
Copy link
Author

Mecalux-Developer commented Aug 21, 2020

I was able to reproduce it in Magento 2.3.4-p2 vainilla with sample data (Luma) in developer Mode without elasticsearch, varnish, redis.

Magento 2.3.4-p2 vainilla (Luma)

Click directly on the link of product in homepage

image

Right click on the link of product in homepage and open it in a new tab

image

We can see that the our custom mixin Mecalux_Ejemplo/js/price-box-mixin does not appears

Note:
Ejemplo is Example in English

@mrtuvn
Copy link
Contributor

mrtuvn commented Aug 23, 2020

Have you add mixin declare in file requirejs-config ?
Check this doc https://devdocs.magento.com/guides/v2.4/javascript-dev-guide/javascript/js_mixins.html
Tried from my local setup with 2.4 latest code (github code) but can't reproduce like your describe
My test case: js minify: NO developer mode: ON not change much in settings admin
See image attach
Screenshot from 2020-08-23 22-49-18

@Mecalux-Developer
Copy link
Author

Mecalux-Developer commented Aug 24, 2020

@mrtuvn Thanks for your answer. We have the requirejs-config.js file created.
To reproduce this problem, we have to go to the home page, then right-click the mouse and open several products in a new browser tab

Sorry, I was wrong in the above message, I put the wrong version. I tested it on 2.3.4-p2 instead of 2.4. Could you try in Magento: 2.3.4-p2?

The folder structure of the example module is the following:

image

The content of the files is:

registration.php

<?php
    \Magento\Framework\Component\ComponentRegistrar::register(
        \Magento\Framework\Component\ComponentRegistrar::MODULE,
        'Mecalux_Ejemplo',
        __DIR__
    );

module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Mecalux_Ejemplo" setup_version="1.0.0"/>
</config>

price-box-mixin.js

define([
    'jquery',
    'Magento_Catalog/js/price-utils',
    'underscore',
    'mage/template',
    'jquery/ui'
], function ($, utils, _, mageTemplate) {
    'use strict';

    return function (priceBox) {
        $.widget('mage.priceBox', priceBox, {
            _setDefaultsFromDataSet: function _setDefaultsFromDataSet() {
               console.log("Hello world");
            },
        });

        return $.mage.priceBox;
    };
});

requirejs-config.js

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

@Mecalux-Developer
Copy link
Author

Mecalux-Developer commented Aug 24, 2020

@mrtuvn It seems the problem is fixed in 2.4. We have not been able to reproduce this problem in 2.4 either. But we have been able to reproduce this problem in 2.3.4-p2 LUMA (Vainilla). Is there a solution for this version(2.3.4-p2)? We plan to update our magento later. Not now.

@mrtuvn
Copy link
Contributor

mrtuvn commented Aug 25, 2020

Don't know but from my knowleadges in 2.4 magento brings update with some improvements in JavaScript . Mixin module has been refactored to improve the loading and application of mixins for advanced bundled modules. But consider update maybe risky for live site running. We can't know problem something went wrong when some 3rd-party modules may breaks compatible

@Mecalux-Developer
Copy link
Author

Mecalux-Developer commented Aug 25, 2020

@mrtuvn Thanks for your reply,
We urgently need a fix for this version (2.3.4-p2). Can you review this case? Some patch etc.
We are really concerned that mixins will not work when we open the pages in a new tab with the right mouse button.
Thanks again, Regards

@mrtuvn
Copy link
Contributor

mrtuvn commented Aug 25, 2020

check a couple PRs
#27690
#25869
#25587

@engcom-Oscar engcom-Oscar added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Sep 18, 2020
@ihor-sviziev ihor-sviziev added the Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch label Sep 29, 2020
@ihor-sviziev ihor-sviziev self-assigned this Sep 29, 2020
@m2-assistant
Copy link

m2-assistant bot commented Sep 29, 2020

Hi @ihor-sviziev. 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.

@ihor-sviziev
Copy link
Contributor

As it was already discussed - issue was already fixed in 2.4.x #29694 (comment), I'm closing this issue as not relevant.

@magento-engcom-team magento-engcom-team added the Reported on 2.3.4-p2 Indicates original Magento version for the Issue report. label Nov 13, 2020
@denistrator
Copy link

@ihor-sviziev hi. the issue is still reproducible on 2.4 when using an alias instead of a path to the component in js layout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Progress: done Reported on 2.3.4-p2 Indicates original Magento version for the Issue report. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
Archived in project
Development

No branches or pull requests

6 participants