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: bug for cache misses and count calls #18

Merged
merged 4 commits into from
Oct 30, 2023

Conversation

pratik151192
Copy link
Collaborator

@pratik151192 pratik151192 commented Oct 30, 2023

Jah reported a bug where 0 was not being compressed:

TypeError: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received type number (0)

This 0 basically comes out of count() queries and if there's no data present. This was being interpreted akin to undefined and never went through the number check and was not being transformed to a string.

Was able to repro through a test that succeeded after bug fix

@pratik151192 pratik151192 marked this pull request as ready for review October 30, 2023 13:23
if (typeof results === 'number') {
// like for count() calls
return results.toString();
if (!data) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i am leaving this as is just for now and will address in a follow up PR based on our discussion in #typescript channel. The reason is this was the behavior Jah expected here in his code and here falsyness might mean multiple things so want to make a more careful call here

Copy link
Collaborator Author

@pratik151192 pratik151192 Oct 30, 2023

Choose a reason for hiding this comment

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

Neverr mind fixed it as i see no other case

@pratik151192 pratik151192 merged commit 2d9173c into main Oct 30, 2023
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