🚑 fix(dialog): showCloseButton Prop Warning in DialogContent Component #2597
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.
Summary
I noticed that the following warning is being output to the console in places where DialogContent is rendered, as well as in the tests for
Dialog.tsx
.However, this error is not output when running docker compose up. I'm not sure if it's due to differences in the library versions in my local environment or differences in the runtime environment. Is this warning not appearing in other developers' environments?
Also, The Close button is always displayed regardless of the value of
showCloseButton
.For example, in DeleteButton.tsx,
showCloseButton
is set tofalse
, but the Close button is always displayed.Cause
I suspect that the reason for this warning message is that the
showCloseButton
property is being passed toDialogPrimitive.Content
, which does not have that property.Change Type
showCloseButton
prop is now destructured in the component's function parameters and is no longer passed to theDialogPrimitive.Content
component.showCloseButton
now defaults totrue
. This maintains backward compatibility.showCloseButton
isfalse
,DialogPrimitive.Close
is not rendered. In the current main branch, this setting is used in the following three files:Testing
showCloseButton
istrue
and is not displayed when it isfalse
.Checklist