This repository was archived by the owner on Sep 23, 2025. It is now read-only.
Do not render "0" when parent height and width are both 0.#61
Open
stonebk wants to merge 4 commits intoawana-archive:masterfrom
Open
Do not render "0" when parent height and width are both 0.#61stonebk wants to merge 4 commits intoawana-archive:masterfrom
stonebk wants to merge 4 commits intoawana-archive:masterfrom
Conversation
mariomc
reviewed
Mar 13, 2017
| <div style={wrapperStyle} ref='wrapper'> | ||
| {(containerWidth || containerHeight) && | ||
| <ComposedComponent | ||
| {(containerWidth || containerHeight) |
There was a problem hiding this comment.
This way you are not creating the ComposedComponent if the dimensions are 0. This may lead to some confusion.
You could solve the printing of '0' by casting the above statement to a boolean like this !!(containerWidth || containerHeight)
Author
There was a problem hiding this comment.
ComposedComponent is already not being created. {(0 || 0) && <ComposedComponent>} becomes {0} which will render "0" as text. {(0 || 0) ? <ComposedComponent> : null} becomes {null} which will render nothing.
There was a problem hiding this comment.
That is indeed true and a derp on my part. Disregard my comments ;)
|
Any plans to merge this? |
|
Yeah, this is a pretty weird bug - would be great to have this merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The following will render "0":