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

Pagination params fix #702

Merged
merged 2 commits into from
Nov 25, 2022
Merged

Pagination params fix #702

merged 2 commits into from
Nov 25, 2022

Conversation

SuperSonicHub1
Copy link
Contributor

Fixes #698.

src/paginator.ts Outdated
@@ -37,6 +37,7 @@ export class Paginator<Params, Result>
typeof response.headers?.link === 'string'
? this.pluckNext(response.headers.link)
: undefined;
this.nextParams = {};
Copy link
Owner

Choose a reason for hiding this comment

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

Typecheck seems to be failing. You can just add downcasting such as {} as Params for now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

This stops the duplication of query parameters in our request URL, as Mastodon already gives us the correct parameters in the `Link` header. In some cases, a mixture of parameters from `params` and the `Link` URL could cause the iterator to get caught in an infinite loop. Fixes neet#698.
…rameters

Now that query parameter duplication has been fixed, users should be able to safely use `maxId` and `sinceId` in their code. Fixes neet#698.
@neet neet merged commit 03805f9 into neet:main Nov 25, 2022
neet added a commit that referenced this pull request Nov 25, 2022
neet added a commit that referenced this pull request Nov 25, 2022
github-actions bot pushed a commit that referenced this pull request Nov 26, 2022
## [4.6.9](v4.6.8...v4.6.9) (2022-11-26)

### Bug Fixes

* Actually send user-specified headers in `HttpAxiosImpl` ([b602fe4](b602fe4)), closes [#697](#697)
* Encode URI components in serializer ([8a2be08](8a2be08))
* **fetch:** Normalize header to be lowercase ([f7fce11](f7fce11))
* Fix failing test in [#702](#702) ([a2a4c26](a2a4c26))
* read next link from response ([68c71bd](68c71bd))
* Set `Paginator.nextParams` to an empty object after first request ([4ce57a6](4ce57a6)), closes [#698](#698)
* Unmark `DefaultPaginationParams.{maxId, sinceId}` as internal parameters ([257359e](257359e)), closes [#698](#698)
* Update Notification.type types ([#706](#706)) ([50c5c5c](50c5c5c))
@github-actions
Copy link

🎉 This PR is included in version 4.6.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

maxId in DefaultPaginationParams should be able to be set externally
2 participants