Skip to content

The Component model is unnecessarily initialized  #2776

Open
@paulochang

Description

@paulochang

Bug Report

Current Behavior
Some components retrieve the component id from its corresponding sling model (i.e The accordion component) while others explicitly initialize an instance of the Component model (i.e. The button component). This last initialization is unnecessary (as all component's sling models inherit and implement the main Component model).

Expected behavior/code
All components should retrieve the Component's ID directly from its corresponding sling model, no further initialization is needed.

Environment

  • NA

Possible Solution
I would like to have all the initialization and calls to the general component model replaced with a call to the specific component model for each model.

Additional context / Screenshots

Example:

Given the existing Button HTL code

<button data-sly-use.button="com.adobe.cq.wcm.core.components.models.Button"
        data-sly-use.component="com.adobe.cq.wcm.core.components.models.Component"
        ....
        id="${component.id}"

We'd do a replacement with the following code instead

<button data-sly-use.button="com.adobe.cq.wcm.core.components.models.Button"
        ...
        id="${button.id}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions