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

Create list of components that need an update to address errors when being dynamically generated by JavaScript #532

Closed
Patrick-Daly-AA opened this issue Mar 28, 2024 Discussed in #529 · 2 comments
Labels
Type: Refactoring A code change that neither fixes a bug nor adds a feature wc-generator

Comments

@Patrick-Daly-AA
Copy link
Contributor

Discussed in https://github.com/orgs/AlaskaAirlines/discussions/529

Originally posted by jordanjones243 March 21, 2024
An issue was brought to my attention recently with creating an instance of auro-popover through JavaScript that likely can come up in other components:

Basically, in most of our components, we have attributes that are applied to our custom elements. These attributes are usually initialized inside of our constructor and some are reflected onto the element in the DOM. Where the issue arises is when we try to create a component using the DOM (via JavaScript). An error is thrown because the DOM is complaining that it cannot create an element that already has attributes applied to it. In this case, we had our auro-popover component being created with an id attribute already being assigned a value in the constructor.

What we need to do is go through all of our components and move all of our attributes that are being reflected onto the components from being initialized in the constructor to the connectedCallback() function, which runs once an element is attached to the DOM.

This simple change from auro-popover can be used as a guide to make the change in any other component that can run into this issue:

@Patrick-Daly-AA Patrick-Daly-AA added the Type: Refactoring A code change that neither fixes a bug nor adds a feature label Mar 28, 2024
@Patrick-Daly-AA
Copy link
Contributor Author

As an output for this issue, Issues should be created in each component which needs updates.

@Patrick-Daly-AA Patrick-Daly-AA removed their assignment Mar 28, 2024
@Patrick-Daly-AA Patrick-Daly-AA changed the title Create list of components that need an update to address errors when being dynamically generated by Java Script Create list of components that need an update to address errors when being dynamically generated by JavaScript May 22, 2024
@Patrick-Daly-AA
Copy link
Contributor Author

Will be continuing determining next steps in the discussion linked in the body of the issue.

@Patrick-Daly-AA Patrick-Daly-AA closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Refactoring A code change that neither fixes a bug nor adds a feature wc-generator
Projects
None yet
Development

No branches or pull requests

2 participants