Possibly stems from a quirk with how Ember templates are updated, but re-rendering the CalciteSelect component causes the menu to appear blank.
After re-render, opening the calcite select menu reveals a list of blank options.
After a re-render, opening the calcite select menu reveals its list of options.
Seen in latest macOS versions of Chrome, Firefox, and Safari. Additionally, the following console error appears:
TypeError: undefined is not an object (evaluating 'this.selectEl.append')
One possible workaround is to populate the calcite-option elements' label attributes. This appears to have the side-effect of keeping the option values populated.
This is also affecting us when using React it looks like the mutation events MIGHT trigger before the select is rendered hence why this.selectEl is undefined.
Installed.
@nwhittaker, @patrickarlt could you help verify this with @esri/calcite-components@next?
@nwhittaker, @patrickarlt could you help verify this with @esri/calcite-components@next?
@jcfranco, I updated the js bin to reference the @next Calcite tag[1] and I no longer see the console error, but the menu is still blank for me after the second render. Per https://github.com/Esri/calcite-components/issues/1409#issuecomment-751835804, I think the underlying error is that for the second render, the mutationObserver is firing before storeSelectRef() is called.
For the first render, mutationObserver fires after the call to storeSelectRef() -- which would explain why we don't see a problem until subsequent renders.
[1] https://jsbin.com/cosalesiya/2/edit?html,js,console,output
I think the underlying error is that for the second render, the mutationObserver is firing before storeSelectRef() is called.
storeSelectRef executes the method from the mutation observer callback, so I think there's another issue here. I'll take another look.
Thanks for testing!
storeSelectRefexecutes the method from the mutation observer callback, so I think there's another issue here.
I guess my point is that selectEl is currently set in storeSelectRef, so if that runs before the mutation callback fires, selectEl isn't populated yet:
Took a look at this today and noticed that it works fine with the debug build, but not with the production one. I'll have to do some more digging. In the meantime, could you try using the label prop? https://jsbin.com/vuqujuguko/edit?html,js,output
In the meantime, could you try using the label prop?
Confirming this looks like a reasonable workaround for the time being -- thanks. I'll add a note to the issue description.
Thanks guys! Closing this out, please re-open if there are further issues.
There is a workaround, but this hasn't been fixed. Reopening to not lose track of this.
This should be fixed now.
Self-verified with the provided test case + @[email protected].