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

[Table] all EditableCell re-render every time on focus change in Table with enableFocusedCell={true} #3642

Closed
HZ-labs opened this issue Jul 3, 2019 · 1 comment · Fixed by #3649

Comments

@HZ-labs
Copy link

HZ-labs commented Jul 3, 2019

Environment

  • Package version(s): @blueprintjs/core: 3.17.1, @blueprintjs/table: 3.6.0
  • Browser and OS versions:

Link to a minimal repro: https://codesandbox.io/s/blueprintjs-rerender-editablecell-enablefocusedcell-t7uf8

Steps to reproduce

  1. Create Table with enableFocusedCell = true and EditableCell
  2. Click on some Cell

Actual behavior

http://g.recordit.co/PQ3R4HDBgf.gif
PQ3R4HDBgf

Expected behavior

Update Cell only if it is changed
like enableFocusedCell = false:
http://g.recordit.co/SwS3Rd7mwH.gif
SwS3Rd7mwH

@HZ-labs HZ-labs changed the title [Table] all EditableCell re-render every time on focus change in Table with enableFocusedCell={true} and [Table] all EditableCell re-render every time on focus change in Table with enableFocusedCell={true} Jul 3, 2019
@tanmoyopenroot
Copy link
Contributor

tanmoyopenroot commented Jul 9, 2019

Hi @HZ-labs,
The re-rendering was due to the passing of an anonymous function.

Screenshot from 2019-07-09 14-54-32

Therefore after every shallow comparing the props shouldComponentUpdate would return true.

check shouldComponentUpdate function
https://github.com/palantir/blueprint/blob/develop/packages/table/src/cell/editableCell.tsx#L116

It's your codesandbox example with some tweaks https://codesandbox.io/s/blueprintjs-rerender-editablecell-enablefocusedcell-w2spw

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

Successfully merging a pull request may close this issue.

3 participants