Open steven-hoffman-jomashop opened 2 months ago
Hi @steven-hoffman-jomashop. Thank you for your report. To speed up processing of this issue, 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@magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: 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.
Hi @engcom-November. 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: :point_down:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. Hello @steven-hoffman-jomashop,
Thank you for the report and collaboration!
I agree that if the collection is already loaded we should call count, but addMediaGalleryData
function has been called in other classes which does not specify if the collection is loaded or not, can you make sure that this will not cause problems in these classes.
Hi @engcom-November,
... addMediaGalleryData function has been called in other classes which does not specify if the collection is loaded or not, ... this will not cause problems ...
Please see above.
It should be safe to add a
if($this->isLoaded())
prior to callinggetSize
, and if loaded, call count instead ofgetSize
. ...
In summary: Those other uses, where the category is not yet loaded, will return false for isLoaded
, and thus addMediaGalleryData
can call getSize for that code path; (and if isLoaded
true, it can call count). This avoid the issue of the other code paths and speeds up the code paths where the collection is loaded.
Hello @steven-hoffman-jomashop,
I agree with this, since there is a if clause it won't effect other implementation, hence confirming the issue.
Thank you.
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-13055 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
:x: You don't have permission to export this issue.
Preconditions and environment
The call to getSize is clearly un-needed for the GQL code path for products.
if (!$this->getSize()) {
on a collection that is loaded already. At this point we can call count. (Or just check the empty on the getItems).It should be safe to add a
if($this->isLoaded())
prior to calling getSize, and if loaded, call count instead of getSize. (It should also be safe to just use the count/empty of getItems, (As getItems calls load), but calling isLoaded and using count should be safe and would mitigate this specific issue).Steps to reproduce
Expected result
getSize is not called on a loaded product collection. (When the non-paginated count is not needed).
Actual result
getSize is called on a loaded paginated collection to check if it has data.
Additional information
No response
Release note
No response
Triage and priority