Skip to content

Conversation

@EvHaus
Copy link
Contributor

@EvHaus EvHaus commented Apr 19, 2025

Similar to #3149 and #3142, this PR fixes a bug introduced in this change. When a wrap value of undefined or null is passed to <View> components, the latest versions of react-pdf will treat it as false instead of true (which should be the default value).

Also adds tests for this function.

@changeset-bot
Copy link

changeset-bot bot commented Apr 19, 2025

⚠️ No Changeset found

Latest commit: 7324cf2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@diegomura
Copy link
Owner

Is it correct that undefined was already returning true? I'm not sure about null though. That's a falsy value. Makes more sense to me to false for null than true

@EvHaus
Copy link
Contributor Author

EvHaus commented Sep 30, 2025

Is it correct that undefined was already returning true?

The current behaviour is:

  1. <View /> is treated as true
  2. <View wrap={undefined} /> is treated as false
  3. <View wrap={null} /> is treated as false
  4. <View wrap={false} /> is treated as false
  5. <View wrap={true} /> is treated as false

I think 1, 4 and 5 make sense. But 2 and 3 are unexpected to me.

I'm not sure about null though. That's a falsy value. Makes more sense to me to false for null than true

I see where you're coming from however given that "no value" (case 1) and undefined (case 2) will evaluate to true I think having null evaluate to true is a more developer-friendly/consistent experience.

Let me know if you feel strongly about it and I'll make the PR change accordingly. Thanks @diegomura!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants