@@ -394,7 +394,7 @@ export class SandboxClient {
394394 * This method supports two modes of operation:
395395 * 1. Simple limit-based fetching (default):
396396 * ```ts
397- * // Get up to 100 sandboxes (default)
397+ * // Get up to 50 sandboxes (default)
398398 * const { sandboxes, totalCount } = await client.list();
399399 *
400400 * // Get up to 200 sandboxes
@@ -423,10 +423,10 @@ export class SandboxClient {
423423 pagination ?: PaginationOpts ;
424424 } = { }
425425 ) : Promise < SandboxListResponse > {
426- const limit = opts . limit ?? 100 ;
426+ const limit = opts . limit ?? 50 ;
427427 let allSandboxes : SandboxInfo [ ] = [ ] ;
428428 let currentPage = opts . pagination ?. page ?? 1 ;
429- let pageSize = opts . pagination ?. pageSize ?? 50 ;
429+ let pageSize = opts . pagination ?. pageSize ?? limit ;
430430 let totalCount = 0 ;
431431 let nextPage : number | null = null ;
432432
@@ -457,11 +457,14 @@ export class SandboxClient {
457457 tags : sandbox . tags ,
458458 } ) ) ;
459459
460- allSandboxes = [ ...allSandboxes , ...sandboxes ] ;
460+ const newSandboxes = sandboxes . filter (
461+ ( sandbox ) =>
462+ ! allSandboxes . some ( ( existing ) => existing . id === sandbox . id )
463+ ) ;
464+ allSandboxes = [ ...allSandboxes , ...newSandboxes ] ;
461465
462466 // Stop if we've hit the limit or there are no more pages
463467 if ( ! nextPage || allSandboxes . length >= limit ) {
464- allSandboxes = allSandboxes . slice ( 0 , limit ) ;
465468 break ;
466469 }
467470
0 commit comments