Skip to content

Commit

Permalink
fix(requests): staleTime can be undefined (#482)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benny739 authored Sep 7, 2023
1 parent dd154fa commit 9fb0651
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/requests/src/lib/requests-result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,19 +185,19 @@ interface Options<TData> {
// Wheteher to cache the response data
cacheResponseData?: boolean;
// Whether to cache request result for any additional keys
additionalKeys?: (_: TData) => unknown[][],
additionalKeys?: (_: TData) => unknown[][];
}

export function trackRequestResult<TData>(
key: unknown[],
options?: Options<TData>,
options?: Options<TData>
): MonoTypeOperatorFunction<TData> {
return function (source: Observable<TData>) {
return getRequestResult(key).pipe(
take(1),
switchMap((result) => {
const stale = options?.staleTime
? result.staleTime! < Date.now()
? (result.staleTime ?? 0) < Date.now()
: false;

const preventConcurrentRequest =
Expand Down

0 comments on commit 9fb0651

Please sign in to comment.