TW-Elements icon indicating copy to clipboard operation
TW-Elements copied to clipboard

[Select] [duplication of select component when reinitializing it]

Open memiljamel opened this issue 1 year ago • 1 comments

I found the same problem here #1891. The solution provided works, but there are duplicate elements in the select component. I have also asked there, but there has been no response.

Here's the screenshot: Capture

1

does anyone know why this happens?

memiljamel avatar Jun 19 '24 10:06 memiljamel

Hi, the issue was closed thats why we missed it.

You can try checking whether the instance exists before calling initTE again (in side the life cycle method, or other place you are using it)

This could look something like this:

if (!Select.getInstance(mySelectInstance) {
  initTE({Select})
}

The initTE method with flag allowReinits creates a new instance for components and does not check whether components were initialized before or not. Checking whether the instance exists before calling it should work here

juujisai avatar Jun 20 '24 05:06 juujisai