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

[core] fix(EditableText): optimize updateInputDimensions #4723

Conversation

SatishGandham
Copy link
Contributor

Checklist

  • Includes tests
  • Update documentation

Changes proposed in this pull request:

componentDidUpdate of Editable text calls updateInputDimensions on every rerender, this triggers the layout calculations.
This PR addresses that issue by only calling updateInputDimensions only when the props it depends on change

ref: #4639 (comment)

Reviewers should focus on:

Confirm if calling updateInputDimensions conditionally is a safe change

@adidahiya
Copy link
Contributor

@SatishGandham thanks for taking my suggestion and running with it. Looks like it is an incomplete implementation and will need to be adjusted / tweaked to get the right behavior. There are a few problems with this approach right now.

(1) The input is not expanding its height past its minLines to accommodate longer text:

image

(2) When switching to alwaysRenderInput={false}, the component collapses completely:

2021-05-18 12 14 38

Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my feedback above

@SatishGandham
Copy link
Contributor Author

@adidahiya, Made the necessary changes.
We are now watching state.value and props.alwaysRenderInput

@adidahiya adidahiya changed the title EditableText: Call updateInputDimensions only when the props it depends on change [core] fix(EditableText): optimize updateInputDimensions May 19, 2021
@adidahiya adidahiya merged commit 0de3a76 into palantir:develop May 19, 2021
@adidahiya
Copy link
Contributor

thanks @SatishGandham!

@iamakulov
Copy link

Thank you @SatishGandham 🙌 Never got time to finish the implementation in #4639 myself.

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

Successfully merging this pull request may close these issues.

3 participants