react-multi-select icon indicating copy to clipboard operation
react-multi-select copied to clipboard

List doesn't get rendered when items are loaded async and select component is hidden

Open SEUH opened this issue 5 years ago • 11 comments

I load the items for the multi select component asynchonously and the component is hidden at render time.

Expected Behavior

Items render normally

Actual Behavior

Items don't render

Steps to Reproduce the Problem

Just set the items variable asynchonously and set display none of component Here's a reproduction setup (i use bootstrap tab for simplicity, but it should be equivalent to the setup i described): https://codesandbox.io/s/94nlm5mjrr

Specifications

  • Version: v1.0.73
  • Platform: Chrome/Ubuntu 18
  • Subsystem:

My guess is that at render time, due that the component is not visible, it has no actual height. And because this package uses "react-height" i think that might be the problem.

SEUH avatar Apr 27 '19 01:04 SEUH

Thanks @SEUH ! @stepovat if this is indeed a case (I did not have a look), caused by react-height, I think it's time to replace that package. It hasn't been supported for a while, it's been giving us other issues and we can produce it's feature in other means.

liorheber avatar Apr 27 '19 04:04 liorheber

hey, I replaced approach with react-height, works perfect, please take a look ( @liorheber @stepovat ) @SEUH Thanks for deep investigation!

yegor-babiy avatar May 01 '19 11:05 yegor-babiy

Hi @SEUH, we have merged the solution, it is included into v1.1.1 release. Please tell if it is ok now, Thanks

stepovat avatar May 12 '19 12:05 stepovat

@stepovat This doesn't seem to be fixed. Have a look at the updated reproduction setup (now with v1.1.1) https://codesandbox.io/s/r5q843yjq

SEUH avatar May 14 '19 14:05 SEUH

@SEUH Could you please tell if it reproduces for you not in the scope of codesandbox?

yegor-babiy avatar May 14 '19 16:05 yegor-babiy

Sorry for the late response. It still fails in my local setup

SEUH avatar May 18 '19 12:05 SEUH

@SEUH Sorry, but this problem is not react-multi-select. If you use https://react-bootstrap.github.io/components/tabs/#tab-props. You need mountOnEnter = {true} in the second tab. In documentation react-bootstrap, describes in more detail why this happens. <Tab eventKey="categories" title={"was not visible at render time"} mountOnEnter={true} >

Сould you please recheck and give feedback for us if it works for you, thanks!

MaksimDrobchak avatar May 21 '19 14:05 MaksimDrobchak

@MaksimDrobchak The problem is with react-multi-select. I adjusted the reproduction setup (removed bootstrap) to make it clearer https://codesandbox.io/s/affectionate-worker-6wt8r

This should be self-explanatory: The component is rendered & mounted but with "display: none" the component is not visible and has no height in the dom. If you take a closer look not only the items are not rendered but also the container for the items.

And "mountOnEnter" should also be self-explanatory. This only means that the component is only mounted when tab enter and thus not hidden, which means that the error does not occur.

A picture for illustration (took from reproduction setup output code):

image

SEUH avatar May 24 '19 12:05 SEUH

Still not working with v1.1.5. Is there any update on this?

SEUH avatar Dec 09 '19 01:12 SEUH

same by me here any update?

binnyFriedman avatar Jan 03 '20 18:01 binnyFriedman

Hi, I'm sorry it took us time to reply.

We are currently a bit short on maintenance capacity for the component internally. While we do plan to fix more bugs in the future, this may take some considerable time.

Therefore, I encourage you or anyone else to contribute fixes to the component. We would be more than happy to assist anyone who would want to contribute.

liorheber avatar Jan 03 '20 21:01 liorheber