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

The Component model is unnecessarily initialized #2776

Open
paulochang opened this issue Jun 5, 2024 · 0 comments · May be fixed by #2777
Open

The Component model is unnecessarily initialized #2776

paulochang opened this issue Jun 5, 2024 · 0 comments · May be fixed by #2777

Comments

@paulochang
Copy link

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}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant