Skip to content

Commit 55efe85

Browse files
feat(deps): bump @seamapi/http from 1.25.0 to 1.25.1 in the seam group (#235)
* feat(deps): bump @seamapi/http from 1.25.0 to 1.25.1 in the seam group Bumps the seam group with 1 update: [@seamapi/http](https://github.com/seamapi/javascript-http). Updates `@seamapi/http` from 1.25.0 to 1.25.1 - [Release notes](https://github.com/seamapi/javascript-http/releases) - [Changelog](https://github.com/seamapi/javascript-http/blob/main/.releaserc.json) - [Commits](seamapi/javascript-http@v1.25.0...v1.25.1) --- updated-dependencies: - dependency-name: "@seamapi/http" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: seam ... Signed-off-by: dependabot[bot] <[email protected]> * ci: Generate code --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Seam Bot <[email protected]>
1 parent 13f6d59 commit 55efe85

File tree

3 files changed

+37
-10
lines changed

3 files changed

+37
-10
lines changed

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Instead, it re-exports from a core set of Seam modules:
4545
- [Action Attempts](#action-attempts)
4646
- [Pagination](#pagination)
4747
- [Manually fetch pages with the nextPageCursor](#manually-fetch-pages-with-the-nextpagecursor)
48+
- [Resume pagination](#resume-pagination)
4849
- [Iterate over all pages](#iterate-over-all-pages)
4950
- [Iterate over all resources](#iterate-over-all-resources)
5051
- [Return all resources across all pages as an array](#return-all-resources-across-all-pages-as-an-array)
@@ -339,6 +340,32 @@ if (hasNextPage) {
339340
}
340341
```
341342

343+
#### Resume pagination
344+
345+
Get the first page on initial load:
346+
347+
```ts
348+
const params = { limit: 20 }
349+
350+
const pages = seam.createPaginator(seam.devices.list(params))
351+
352+
const [devices, pagination] = await pages.firstPage()
353+
354+
localStorage.setItem('/seam/devices/list', JSON.stringify([params, pagination]))
355+
```
356+
357+
Get the next page at a later time:
358+
359+
```ts
360+
const [params = {}, { hasNextPage = false, nextPageCursor = null } = {}] =
361+
JSON.parse(localStorage.getItem('/seam/devices/list') ?? '[]')
362+
363+
if (hasNextPage) {
364+
const pages = seam.createPaginator(seam.devices.list(params))
365+
const [moreDevices] = await pages.nextPage(nextPageCursor)
366+
}
367+
```
368+
342369
#### Iterate over all pages
343370

344371
```ts
@@ -376,7 +403,7 @@ const pages = seam.createPaginator(
376403
}),
377404
)
378405

379-
const devices = await pages.toArray()
406+
const devices = await pages.flattenToArray()
380407
```
381408

382409
### Interacting with Multiple Workspaces

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"npm": ">= 9.0.0"
6666
},
6767
"dependencies": {
68-
"@seamapi/http": "1.25.0",
68+
"@seamapi/http": "1.25.1",
6969
"@seamapi/types": "1.356.0",
7070
"@seamapi/webhook": "1.1.1",
7171
"zod": "^3.21.4"

0 commit comments

Comments
 (0)