-
Notifications
You must be signed in to change notification settings - Fork 9.4k
bug-fix #16074 - Fix theme change in middle of product page. #19124
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
bug-fix #16074 - Fix theme change in middle of product page. #19124
Conversation
product page, regardless of the design exception.
|
Hi @drew7721. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
|
@magento-engcom-team give me test instance |
|
Hi @drew7721. Thank you for your request. I'm working on Magento instance for you |
|
Hi @drew7721, here is your new Magento instance. |
app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php
Outdated
Show resolved
Hide resolved
…of the" This reverts commit 1becee9.
|
Could you consider covering the changed functionality with an automated test (preferably integration)? |
There is a Unit test written for that class.. They both pass. |
|
I guess when @sereban wrote that, he either did not think of the impact changing the theme would have on the rest of the blocks or he just assumed it will only be used trough async calls once the page is loaded. Either way, maybe he can enlighten us on his decision and why setting the theme to the default one is needed at that point, though it seems he has not been that active lately. Regardless, it's obvious it has an undesired impact on the following blocks that will be rendered on the product page. IMO the image creation should be emulated in the current theme and not the default one and that line should simply be removed, but as per your suggestion @slavvka I think it satisfies all functionality. |
Why the fix is not about fixing such block then but rather set theme in another class?
This is bad actually. It means that there is no test currently covering broken scenario. |
It is true that this block does call the data provider(collector) to gather all the data. I don't think the issue lies in the block, but rather in the provider. Blocks should be able to call data providers without fearing that the global theme will be changed. IMO fixing this in the block is like adding fresh paint over a rotten wall, it will cover it for now but further down the line the issue might/will happen again. I think that fixing the issue at the core is the best approach and will also avoid future issues.
I agree, but that should be a different issue, as this PR focuses on fixing the issue at hand, that the front end is broken. That being the main issue that this PR fixes. In my opinion a new issue/PR should be made for the missing tests. |
|
Also, on another note, this issue is relevant to 2.2.* as well so I'm thinking that I should have done this PR against the 2.2-develop branch instead. Let me know if that would be better. |
|
@slavvka, thank you for the updates. |
No, that's okay. We want to have all fixes in 2.3 and then in 2.2 |
So, where global theme is actually changed and why we cannot fix it?
This never works. Automated tests are always to be delivered together with corresponding changes, that's the point. But first we should understand where is the correct place for the fix (probably you and Slava already understand this completely and I'm the only one unaware :)). |
|
@orlangur 😆 np, let me enlighten you. Issue resides here. See how it sets the default theme? That's a big No No! because we don't know where or when the call to that collector might be placed. So this might randomly change the theme. Deleting the line might have done the job since the default theme will be used anyhow, but just to make sure it does not break any other functionality on any other branches out there, I agree with @slavvka that the current approach is best : storing the current theme in a var and setting it back when done. ❓ By the way, I really don't see why a "counter" needs that much information about the product. One might think that the |
…e-16074 # Conflicts: # app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php
|
Hi @drew7721. Thank you for your contribution. |
|
@magento-engcom-team I'll create a backport for 2.2 |
Description (*)
When setting a design exception by user agent for front end, the exception works on all pages except the product page. This was caused by one of the blocks (product_viewed_counter) making a call that would reset the current theme design to the default theme when collecting product data.
See details on how to reproduce in issue #16074 .
The fix does not create any issues and all test continue to pass. There is no need to set the global theme to the default one at that point in the execution.
Solution: remove faulty line.
Fixed Issues (if relevant)
Manual testing scenarios (*)
Contribution checklist (*)