Skip to content

[Issue] Load appropriate slider widget on demand to improve performance #28807

Closed
@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #27616: Load appropriate slider widget on demand to improve performance


Description (*)

This PR is a part of my effort to improve Magento 2 frontend performance.

Because of the fact that all Knockout bindings are registered on every load, there are many dependencies requested no matter if such binding is even used on the page. Changes in this PR include:

  • Touch slider widget customization is moved to a separate file so it can be loaded only on compatible devices.
  • Appropriate slider widget type is loaded on-demand, only when range binding is actually used on the page.

Preconditions (*)

1.Magento 2.4-develop

Steps to reproduce (*)

  1. Add the range slider widget to the page, e.g. by adding the following HTML to the CMS block:
<div class="timeline-scale"></div>
<div class="data-slider" data-bind="{"range":{
                "value": ko.observable(50),
                "min": 1,
                "max": 100,
                "step": 5
            }}">&nbsp;</div>
</div>
  1. Validate that it works for both mouse and touch.

Expected result (*)

  1. Responsive:
    Peek 2020-04-28 11-23PR
    2 .Desktop:
    Peek 2020-04-28 11-26PRDestktop

Actual result (*)

  1. [Screenshots, logs or description]

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)
  • All automated tests passed successfully (all builds are green)

Metadata

Metadata

Assignees

Labels

Component: UiFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P3May be fixed according to the position in the backlog.Progress: doneReported on 2.4.0Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S2Major restrictions or short-term circumventions are required until a fix is available.Triage: DoneHas been reviewed and prioritized during Triage with Product Managers

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions