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

Lazy load data source data for list UI components #37576

Open
wants to merge 7 commits into
base: 2.4-develop
Choose a base branch
from

Conversation

kuafucode
Copy link

Description (*)

If a page has listing UI component, the data source collection of the component is loaded and added to the page DOM in the generated component js tag. However this data collection is never rendered and always refreshed via ajax immediately after page load. It is waste of resource and slows down initial page load.

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes Duplicated calls on all Listing uiComponents #37190

Manual testing scenarios (*)

  1. open any admin listing page that is built using uiCompnennt, e.g. customers listing page

Questions or comments

I think this is a quite exciting performance improvement for many admin pages that has listing component. In my local testing, the TTFB imporved from about 570ms - 420ms

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Jun 4, 2023

Hi @kuafucode. Thank you for your contribution!
Here are some useful tips on how you can test your changes using Magento test environment.

Add the comment under your pull request to deploy test or vanilla Magento instance:
  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@kuafucode
Copy link
Author

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Hotel engcom-Hotel added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Jun 6, 2023
@engcom-Hotel
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest removing else condition for better readability.
Please review and fix failing tests

app/code/Magento/Ui/Component/Listing.php Outdated Show resolved Hide resolved
@ihor-sviziev
Copy link
Contributor

Hi @kuafucode,
Will you be able to fix failing tests?

@ihor-sviziev
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review and fix failing tests

@kuafucode
Copy link
Author

the test is not running and not showing which test case failed, let me try again

@kuafucode
Copy link
Author

@magento run all tests

Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@kuafucode
Copy link
Author

Was able to locate the failed test case, the current PR breaks 'recently viewed' widget. In stead of making the change to Magento\Ui\Component\Listing\Columns\Listing, I should move this change into lower component Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider.

I'm also thinking of introducing a lazy loading flag to data provide class via ui xml, instead of relying content format in request which is not semantic.

ps. I'm a bit suprised to find out the 'recently viewed' widget config is provided by Magento\Catalog\Ui\DataProvider\Product\Listing\DataProvider , IMO it can be fully provided in the ui xml config section

@Priyakshic Priyakshic added the Project: Community Picked PRs upvoted by the community label Oct 15, 2024
@engcom-Dash engcom-Dash self-assigned this Oct 17, 2024
@engcom-Dash
Copy link
Contributor

Was able to locate the failed test case, the current PR breaks 'recently viewed' widget. In stead of making the change to Magento\Ui\Component\Listing\Columns\Listing, I should move this change into lower component Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider.

I'm also thinking of introducing a lazy loading flag to data provide class via ui xml, instead of relying content format in request which is not semantic.

ps. I'm a bit suprised to find out the 'recently viewed' widget config is provided by Magento\Catalog\Ui\DataProvider\Product\Listing\DataProvider , IMO it can be fully provided in the ui xml config section

Hello @kuafucode,

I wanted to follow up on your comment regarding the changes needed for the 'recently viewed' widget and the lazy loading flag. Will you be implementing these updates? If not, please let us know how we should proceed.

Thanks!

@engcom-Dash
Copy link
Contributor

engcom-Dash commented Nov 4, 2024

Closing this PR since it has not been updated in a while. Please feel free to reopen it if needed.

@kuafucode
Copy link
Author

@engcom-Dash please reopen, I'm picking up this work again.

@engcom-Dash
Copy link
Contributor

@engcom-Dash please reopen, I'm picking up this work again.

@kuafucode- I am reopening this PR. Please review and address the #37576 (comment) so we can proceed. Thank you!

@engcom-Dash engcom-Dash reopened this Dec 9, 2024
Copy link

m2-assistant bot commented Dec 9, 2024

Hi @kuafucode. Thank you for your contribution!
Here are some useful tips on how you can test your changes using Magento test environment.
❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@engcom-Dash
Copy link
Contributor

@kuafucode: As discussed over Slack, I'm putting it on hold for now. Once you are done with the implementation, please let us know. We'll pick it up and proceed with the necessary steps. Thanks.

@engcom-Dash
Copy link
Contributor

Hello @kuafucode,

This is a reminder to please address this #37576 (comment).

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Performance Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: needs update Project: Community Picked PRs upvoted by the community
Projects
Status: On Hold
Development

Successfully merging this pull request may close these issues.

Duplicated calls on all Listing uiComponents
6 participants