@@ -153,17 +153,22 @@ async function listItems(args: ExecuteServerSelectorArgs) {
153153 throw new SelectorOptionsUnavailableError ( )
154154 }
155155
156- const reportedLimit = requirePaginationNumber ( data . pagination . limit , { positive : true } )
157- const reportedOffset = requirePaginationNumber ( data . pagination . offset )
158- const reportedTotal = requirePaginationNumber ( data . pagination . total )
156+ const reportedLimit =
157+ data . pagination . limit === undefined
158+ ? WEBFLOW_ITEM_PAGE_SIZE
159+ : requirePaginationNumber ( data . pagination . limit , { positive : true } )
160+ const reportedOffset =
161+ data . pagination . offset === undefined ? offset : requirePaginationNumber ( data . pagination . offset )
162+ const reportedTotal =
163+ data . pagination . total === undefined ? undefined : requirePaginationNumber ( data . pagination . total )
159164 if (
160165 reportedLimit > WEBFLOW_ITEM_PAGE_SIZE ||
161166 reportedOffset !== offset ||
162167 data . items . length > reportedLimit
163168 ) {
164169 throw new SelectorOptionsUnavailableError ( )
165170 }
166- if ( data . items . length === 0 && reportedOffset < reportedTotal ) {
171+ if ( data . items . length === 0 && reportedTotal !== undefined && reportedOffset < reportedTotal ) {
167172 throw new SelectorOptionsUnavailableError ( )
168173 }
169174
@@ -181,7 +186,12 @@ async function listItems(args: ExecuteServerSelectorArgs) {
181186 } )
182187 return listSelectorResult (
183188 items ,
184- data . items . length > 0 && nextOffset < reportedTotal ? String ( nextOffset ) : undefined
189+ data . items . length > 0 &&
190+ ( reportedTotal === undefined
191+ ? data . items . length === reportedLimit
192+ : nextOffset < reportedTotal )
193+ ? String ( nextOffset )
194+ : undefined
185195 )
186196}
187197
0 commit comments