diff --git a/packages/arcgis-rest-portal/src/items/get.ts b/packages/arcgis-rest-portal/src/items/get.ts index 7b20511e6c..6c26304128 100644 --- a/packages/arcgis-rest-portal/src/items/get.ts +++ b/packages/arcgis-rest-portal/src/items/get.ts @@ -148,13 +148,16 @@ export function getItemResources( ): Promise { const url = `${getPortalUrl(requestOptions)}/content/items/${id}/resources`; - // mix in user supplied params - requestOptions.params = { - ...requestOptions.params, - num: 1000 + // Mix in num:1000 with any user supplied params + // Key thing - we don't want to mutate the passed in requestOptions + // as that may be used in other (subsequent) calls in the course + // of a long promise chains + const options: IRequestOptions = { + ...requestOptions }; + options.params = { num: 1000, ...options.params }; - return request(url, requestOptions); + return request(url, options); } export interface IGetItemGroupsResponse {