Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we add a comment explaining the purpose of this code?
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.
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 also thought of asking for a comment here but the line looks pretty self-explanatory no? If there is no width in the modal it means it shouldn't be rendered right?
Uh oh!
There was an error while loading. Please reload this page.
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.
The purpose of the function
updateBoundswas only to save the bounds. This is clearly a side-effect. Now I think we should move this condition somewhere else.Let's watch out for these side-effects and try to keep pure functions clean. cc: @sobitneupane
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.
Ummm, that makes total sense : )
@parasharrajat pretty sure you understand this much better than I do so can you help me understand what problems does that line cause?
Also, I'm not sure where else to add this condition if we really want to move this logic.
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.
This should go to
componentDidUpdatefor class components. Or we can rename this function if this place is convenient.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.
@parasharrajat @PauloGasparSv as updateBounds is the place where we can apply bounds.width check because here we have direct access to this variable. So I think instead of dealing with multiple side effects like componentDidUpdate and updateBounds we can go with the suggestion of @parasharrajat to rename this function, which will keep the rendering logic of the tooltip in one place.
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.
Great, let's please change that function name then :D
Tks again for the help and explanation @parasharrajat
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.
Since everything related to this issue is closed and paid out and the whole review process is a bit lengthy I think we should rename that in a new P.R. but not necessarily create a new one.
I'll try to fix this next time I work on an App P.R. since it's not a priority.