Skip to content

Conversation

neet
Copy link
Owner

@neet neet commented Apr 27, 2025

Close #1282

@Copilot Copilot AI review requested due to automatic review settings April 27, 2025 03:03
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses issue #1282 by ensuring that falsy values, such as 0, are correctly encoded into query string parameters rather than being omitted.

  • Added tests to verify that objects containing a 0 value are properly serialized.
  • Modified the filter logic in flattenForRailsQueryString to include falsy values except for undefined.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/adapters/serializers/serializer-native-impl.spec.ts Added a test case for serializing a 0 value in querystring format
src/adapters/serializers/flatten.ts Revised filter logic to ensure 0 is not omitted in querystring serialization
src/adapters/serializers/flatten.spec.ts Added a test case to check for proper encoding of an object with a value of 0
Comments suppressed due to low confidence (1)

src/adapters/serializers/flatten.ts:49

  • Changing the filter to use 'v != undefined' correctly retains 0, but it will also include null values. Confirm if null values should be included in the querystring or if an additional check should be applied.
.filter(([, v]) => v != undefined)

Copy link

pkg-pr-new bot commented Apr 27, 2025

Open in StackBlitz

npm i https://pkg.pr.new/neet/masto.js/masto@1287

commit: 1b2418f

Copy link

size-limit report 📦

Path Size
dist/index.js 6.44 KB (+0.05% 🔺)

@neet neet merged commit 7944f66 into main Apr 27, 2025
7 checks passed
@neet neet deleted the fix-1282 branch April 27, 2025 03:09
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.

setting limit to 0 for paginator does not get all results w/o pagination
1 participant