Skip to content

Commit 34dad65

Browse files
authored
Merge pull request #534 from kuhe/pagination-conditions
check for pagination stopOnSameToken option
2 parents 726e52c + b432b27 commit 34dad65

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/PaginationGenerator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ private void writePager() {
202202
});
203203

204204
writer.write("yield page;");
205+
writer.write("const prevToken = token;");
205206
writer.write("token = page$L;", destructurePath(outputTokenName));
206-
207-
writer.write("hasNext = !!(token);");
207+
writer.write("hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));");
208208
});
209209

210210
writer.write("// @ts-ignore");

0 commit comments

Comments
 (0)