You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I’m currently facing challenges with reinitializing Flowbite components dynamically in my project. When attempting to reinitialize components, it’s difficult to determine if a component has already been initialized, which leads to potential issues such as duplicate initializations or unnecessary reinitialization processes.
Describe the solution you'd like
I would like Flowbite to add a data-initialized="true" attribute to each component after it has been initialized. This attribute would serve as a flag indicating that the component has already undergone the initialization process, making it easier to manage and control reinitialization in dynamic applications.
Describe alternatives you've considered
An alternative solution could involve manually tracking the initialization state of each component within our application code. However, this approach is less efficient, more error-prone, and requires additional logic to maintain, especially as the number of components grows.
Additional context
Adding the data-initialized="true" attribute would greatly simplify the management of component states in dynamic environments where components are frequently added, removed, or updated. It would also enhance the flexibility of Flowbite in projects that require custom initialization logic. Here is a sample implementation:
Eg: initDropdowns document .querySelectorAll('[data-dropdown-toggle]:not[ data-initialized="true"]')
It helps after Turbo stream renders the callback initFlowbite not re-initialized existing dropdown while user use it
The text was updated successfully, but these errors were encountered:
honeypc
changed the title
Add attribute data-initialized=true to the component was
Add attribute data-initialized=true to the component has been initialized
Aug 21, 2024
Is your feature request related to a problem? Please describe.
I’m currently facing challenges with reinitializing Flowbite components dynamically in my project. When attempting to reinitialize components, it’s difficult to determine if a component has already been initialized, which leads to potential issues such as duplicate initializations or unnecessary reinitialization processes.
Describe the solution you'd like
I would like Flowbite to add a data-initialized="true" attribute to each component after it has been initialized. This attribute would serve as a flag indicating that the component has already undergone the initialization process, making it easier to manage and control reinitialization in dynamic applications.
Describe alternatives you've considered
An alternative solution could involve manually tracking the initialization state of each component within our application code. However, this approach is less efficient, more error-prone, and requires additional logic to maintain, especially as the number of components grows.
Additional context
Adding the data-initialized="true" attribute would greatly simplify the management of component states in dynamic environments where components are frequently added, removed, or updated. It would also enhance the flexibility of Flowbite in projects that require custom initialization logic. Here is a sample implementation:
Eg:
initDropdowns
document .querySelectorAll('[data-dropdown-toggle]:not[ data-initialized="true"]')
It helps after Turbo stream renders the callback initFlowbite not re-initialized existing dropdown while user use it
The text was updated successfully, but these errors were encountered: