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
I encounter a problem using the Select component, and this is also the case for other components using collection representing the component's items.
In the documentation examples, the list of items is hard defined in the code.
In my application, the items that I want to pass to my component are retrieved by an HTTP request to my API
The problem I encounter is that the component does not refresh when the list of items passed in props changes, even when these items are in a state which has been modified after having retrieved the items.
So in the case of the Select, no item is displayed inside
I tried several things, such as directly calling the collection.setItems method in a useEffect hook when the items change but it doesn't work
So for the moment, I am forced not to render my component until the list of items is loaded, which is not optimal in terms of user experience.
Can you help me on this subject?
(this is what the beginning of my component looks like)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello everyone
I encounter a problem using the
Select
component, and this is also the case for other components usingcollection
representing the component's items.In the documentation examples, the list of items is hard defined in the code.
In my application, the items that I want to pass to my component are retrieved by an HTTP request to my API
The problem I encounter is that the component does not refresh when the list of items passed in props changes, even when these items are in a state which has been modified after having retrieved the items.
So in the case of the
Select
, no item is displayed insideI tried several things, such as directly calling the
collection.setItems
method in auseEffect
hook when the items change but it doesn't workSo for the moment, I am forced not to render my component until the list of items is loaded, which is not optimal in terms of user experience.
Can you help me on this subject?
(this is what the beginning of my component looks like)
Beta Was this translation helpful? Give feedback.
All reactions