-
Notifications
You must be signed in to change notification settings - Fork 37
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
fix(app): Removing infinite loop on modified dropdown render #1697
Conversation
Preview this PR with FeatureBee: https://beta.wandb.ai/?betaVersion=08831672fa5410d3c646cae05be2a98320c8dbe3 |
} | ||
const isOverflow = | ||
optionRef.current.scrollWidth > optionRef.current.clientWidth; | ||
if (optionRef.current && isOverflow !== showTooltip) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is optionRef.current &&
required here now that you are checking above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope
if (isOverflow !== showTooltip) { | ||
setShowTooltip(isOverflow); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this just be setShowTooltip(isOverflow);
? React shouldn't cause an update if it ends up the same boolean value 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You would think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a great answer here. Why this is infinite looping is not exactly known to me. I just know this fixes it as experienced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh wait duh 😂 , that was the previous code. I wonder if this is because of the ref
https://wandb.atlassian.net/browse/WB-19077
Effect updating state causing infinite render. Unsure as to the deeper root cause but this fixes the error.