Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReactVirtualized Table does not update cell height after audio/transcript is updated. #376

Open
keving17 opened this issue Jun 11, 2018 · 2 comments

Comments

@keving17
Copy link
Contributor

This is a visual bug that occurs with PR #375

Before, I used a forceUpdate() to update the entire table when audio and transcripts all returned from s3 and Watson. However, after refactoring the code to have the audio and transcripts as a separate component, the setup I had to automatically resize cell heights in reactVirtualized no longer works properly.

My original setup simply looks at the width of the window and does some calculations to readjust the height and width of cells to contain the contents of each cell. With the new audio player and transcript components, when the components update, the cell does not notice a change in window width so no updates are made. The problem seems simple to fix but I could not figure out how to make it work with React Virtualized. Luckily, the problem only appears when the table is first loaded and the problem is fixed once you adjust the width of the screen a little.

screen shot 2018-06-11 at 12 17 49 am

@kevinrobinson
Copy link
Contributor

@keving17 As you described, having the table be virtualized and doesn't fit well with having each cell dynamically size itself independently so I think this is a fundamental kind of tradeoff with using the library. It looks like there's a hook for this perhaps: https://stackoverflow.com/questions/41402677/how-to-set-up-dynamic-row-height-in-react-virtualized-list#41402914

Another thing you could try is adding overflowY: scroll to that cell, so that if there is a lot of text it will still say the same size, but the user can scroll the cell.

@keving17
Copy link
Contributor Author

Hmmm. So I think I already do something similar with resizing the cell height initially. I think the problem is that I don't store anything in the state so when the audio/transcripts come in, the table/cell is not rendered again. Maybe this could be fixed in the future by making each cell a component?

Also, I played around with the overflow property in the Chrome inspector but couldn't figure it out. I think it might be something with React Virtualized? Since the problem is fixed once the window is resized or the table is rerendered, do you think it is bad to just have the user resize the window or to do a forceUpdate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants