Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't serialize undefined as null #7531

Merged
merged 2 commits into from
Jun 30, 2023

Conversation

wackbyte
Copy link
Contributor

Changes

I added a special case for the serialization of undefined so that serializeProps doesn't serialize it as null.

Closes #7528.

Testing

I expanded on the existing serialization tests and added a new case specifically for undefined.

I also tested it in the example I provided for the issue by changing its astro dependency to the astro package from this PR's branch.

Docs

AFAIK the specific behavior of serialization is not documented, so no docs were added.

I decided to make the changeset a patch bump, but I'm not sure if it would be considered a breaking change instead.

@changeset-bot
Copy link

changeset-bot bot commented Jun 30, 2023

🦋 Changeset detected

Latest commit: 57b9513

The changes in this PR will be included in the next version bump.

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jun 30, 2023
@wackbyte wackbyte force-pushed the serialize-undefined-accurately branch 2 times, most recently from bb2e82d to 8853f33 Compare June 30, 2023 10:12
wackbyte added 2 commits June 30, 2023 14:39

Verified

This commit was signed with the committer’s verified signature.

Verified

This commit was signed with the committer’s verified signature.
@wackbyte wackbyte force-pushed the serialize-undefined-accurately branch from 8853f33 to 57b9513 Compare June 30, 2023 18:39
Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clean fix and great tests!

@natemoo-re natemoo-re merged commit 2172dd4 into withastro:main Jun 30, 2023
@astrobot-houston astrobot-houston mentioned this pull request Jun 30, 2023
@wackbyte wackbyte deleted the serialize-undefined-accurately branch June 30, 2023 22:16
matthewp pushed a commit that referenced this pull request Jul 11, 2023
* fix: don't serialize `undefined` as `null`

* test: include more types in the pass-js test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

undefined props are serialized as null
2 participants