fix: Various fixes to the ModalActions component#615
Conversation
| <ModalActions data-testid="modal-actions"> | ||
| <button>OK</button> | ||
| <button>Cancel</button> | ||
| {null} |
There was a problem hiding this comment.
Wouldn't this make it harder to debug null values as a consumer? Say we are passing down a div containing a null value. We would at least be able to see that the div is correctly being rendered, it just doesn't have a value. Not against it though, just wanted to learn more regarding the decision to ignore them
There was a problem hiding this comment.
Say we are passing down a
divcontaining anullvalue.
What do you mean with "a div containing a null value"? And what do you mean with "debug null values as a consumer"?
There was a problem hiding this comment.
What I understand from the above is that if we have:
<ModalActions data-testid="modal-actions">
<button>{some null value}</button>
</ModalActions>
We would see:
<ModalActions data-testid="modal-actions">
<button>OK</button>
<button>Cancel</button>
</ModalActions>
Is that right? Or would we render a third empty button tag?
And what do you mean with "debug null values as a consumer"?
If I've understood it right and the above example is how it would work, wouldn't it be confusing to eliminate the empty button tag with the null value? Especially as we inspect the DOM to see why it hasn't rendered?
There was a problem hiding this comment.
What the above example shows is that if one of the direct children of ModalActions is null, it will not generate a "slot" in the sequence of inlined elements that are spaced out. It has nothing to do with having non-null children that have their children null.
If this component that we're testing receives a <button>{some null value}</button>, it has no way of knowing that the component has null children. It only knows if its own children are null.
nats12
left a comment
There was a problem hiding this comment.
Looks good! Just left a question around the ignoring of null children, but nothing that's blocking
1570e0e to
fa570d6
Compare
|
@gnapse let's merge this? |
Thanks for the reminder, I had forgotten about this. I'll do a smoke test running Twist locally against this branch, to make sure that it does not break anything. I think I did this at some point, but I'm not 100% sure. |
|
I found no major consequences. The only noticeable thing is that under certain situations (e.g. a This is an expected consequence of the removal of this extra wrapper, as documented here. I'll fix it in Twist in the PR that will upgrade to the new Reactist version, which I'll create this week. |

Closes #613
Supersedes PR #614
Short description
This PR performs the following changes on the
ModalActionscomponent:nullchildrenAdditionally, this removes an extra
Boxwrapping the main element rendered byInline. I was surprised to see it, and did several manual testing (both in the storybook, and running twist-web with my local version of Reactist with these changes in place) and, as I suspected, this outerdivis not needed.PR Checklist
npm run validateand made sure no errors / warnings were shownCHANGELOG.mdpackage.jsonandpackage-lock.json(npm --no-git-tag-version version <major|minor|patch>) refnpm run build-all)Versioning
Queued, to be included in an upcoming release.