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(write): ignore undefined properties #155

Merged
merged 2 commits into from
Mar 4, 2025

Conversation

SoulKa
Copy link
Contributor

@SoulKa SoulKa commented Mar 3, 2025

Closes #152.

Ignore any properties that are undefined. Note that it's not possible (by design) to ignore undefined in getLengthProperty() since returning 0 would result in destroying the stream.

Copy link
Member

@mcollina mcollina 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 opening a PR! Can you please add a unit test?

@SoulKa
Copy link
Contributor Author

SoulKa commented Mar 3, 2025

I added a unit test that tests the new behavior though the test packet might be a little bigger than it needs to. However, I'm unfamiliar with the test framework and the asynchronous parsing makes it hard to debug.

@SoulKa SoulKa requested a review from mcollina March 3, 2025 18:35
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@SoulKa
Copy link
Contributor Author

SoulKa commented Mar 4, 2025

Thanks for picking up this issue so fast! I tested this PR once again using npm link in my actual project and it fixed the original issue (passing undefined correlationData to publishAsync()).

@robertsLando
Copy link
Member

@mcollina can you merge and release?

@mcollina mcollina merged commit 4690e25 into mqttjs:master Mar 4, 2025
3 checks passed
@SoulKa SoulKa deleted the fix/152-undefined-properties branch March 4, 2025 10:35
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.

[Bug]: TypeError when setting Packet Property to undefined
3 participants