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

EuiInMemoryTable - re-rendering all table rows on row mouseover #441

Closed
nreese opened this issue Feb 23, 2018 · 5 comments · Fixed by #665
Closed

EuiInMemoryTable - re-rendering all table rows on row mouseover #441

nreese opened this issue Feb 23, 2018 · 5 comments · Fixed by #665
Labels

Comments

@nreese
Copy link
Contributor

nreese commented Feb 23, 2018

EuiInMemoryTable - re-rendering all table rows on row mouseover. This causes enough of a performance problem to cause the dev tools to freeze up after a while

render

Table set-up

renderTag = (item) => {
      console.log("render column");
      return (
        <div>{item.attributes.title}</div>
      );

  }

  renderTable = () => {
    return (
      <EuiInMemoryTable
        loading={this.state.isFetchingItems}
        items={this.state.tags}
        columns={[
          {
            name: 'Title',
            render: this.renderTag
          }
        ]}
        pagination={true}
        sorting={true}
      />
    );
  }

cc @uboness

@nreese nreese added the bug label Feb 23, 2018
@uboness
Copy link
Contributor

uboness commented Feb 23, 2018

this should be fixed in sass I think... right now it keeps the hover row in the state (while it really shouldn't) @snide mind looking into it?

@uboness
Copy link
Contributor

uboness commented Feb 26, 2018

After looking closer at it, I don't think css/sass is enough. The main problem with this is that we currently need to keep track of the hovered row in the state as we change the rendering of the item actions based on that. There are two options I to resolve this I think:

  1. revisit the design decision of only showing the items on hover (this decision should be made regardless of implementation challenges... if we (dave?) believe that the current behaviour is the preferred one... we should stick to it.

  2. Change the implementation to hold a ref to the actions, and instead of re-rendering the whole table every time, just how & hide the actions directly using the ref.

@snide
Copy link
Contributor

snide commented Feb 26, 2018

I haven't looked too deep into this, but we definitely want to keep actions hidden until hover/focus so you don't overwhelm people. It's perfectly fine to handle this in CSS with something like the below. You'll want to use visibility/opacity instead of display so that it'll be accessible.

tr:hover .myTableActions {
  opacity: 0;
  visibility: hidden;
}

tr:hover .myTableActions,
.myTableActions:focus
{
  opacity: 1;
  visibility: visible;
}

@uboness
Copy link
Contributor

uboness commented Feb 26, 2018

:) I guess it can be handled in css... Awesome! (BTW, we're using opacity now for the exact same reasons)

@snide
Copy link
Contributor

snide commented Feb 26, 2018

Updated my snippet. Focus would need to be on the button, not the row. But yeah, this can be CSS.

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

Successfully merging a pull request may close this issue.

3 participants