fix: treat wrap={undefined} like an omitted wrap prop - #3151
Conversation
🦋 Changeset detectedLatest commit: 276b6bf The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Is it correct that |
The current behaviour is:
I think 1, 4 and 5 make sense. But 2 and 3 are unexpected to me.
I see where you're coming from however given that "no value" (case 1) and Let me know if you feel strongly about it and I'll make the PR change accordingly. Thanks @diegomura! |
cac1e3b to
7324cf2
Compare
I don't think this is right. This case is treated as
|
…stead of true by default
7c8c80d to
276b6bf
Compare
|
My bad on the typo. Updated comment and PR description. Kept
Which I think is really unexpected/clumbsy behaviour. If you still disagree, feel free to close the PR. |
Summary
Similar to #3149 and #3142, this fixes a regression from the layout TypeScript conversion.
After that change, an explicit
wrap={undefined}was treated as falsy (no wrapping), while an omittedwrapprop still defaulted totrue. Those should behave the same.Behaviour
<View />true<View wrap={undefined} />true<View wrap={null} />false<View wrap={false} />false<View wrap={true} />truenullstays falsy (disables wrapping). Onlyundefined/ omitted use the default.Also adds unit tests for
getWrap.Test plan
yarn vitest run packages/layout/tests/node/getWrap.test.tswrappropwrap={false}still prevents page breaks inside the view