Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/utils-reference/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ npm install --save @raycast/utils

## Changelog

### v2.0.1

- Fix types for ESM extensions

### v2.0.0

- The library can now be tree-shaken, reducing its size considerably.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@raycast/utils",
"version": "1.19.1",
"version": "2.0.1",
"description": "Set of utilities to streamline building Raycast extensions",
"author": "Raycast Technologies Ltd.",
"homepage": "https://developers.raycast.com/utils-reference",
Expand Down
8 changes: 4 additions & 4 deletions src/usePromise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export function usePromise<T extends FunctionReturningPromise | FunctionReturnin
latestAbortable.current.current = new AbortController();
}
return ++lastCallId.current;
}, []);
}, [latestAbortable]);

const callback = useCallback(
(...args: Parameters<T>): Promise<UnwrapReturn<T>> => {
Expand Down Expand Up @@ -261,7 +261,6 @@ export function usePromise<T extends FunctionReturningPromise | FunctionReturnin
}, handleError) as Promise<UnwrapReturn<T>>;
},
[
latestAbortable,
latestOnData,
latestOnError,
latestArgs,
Expand All @@ -271,6 +270,7 @@ export function usePromise<T extends FunctionReturningPromise | FunctionReturnin
latestOnWillExecute,
paginationArgsRef,
latestFailureToast,
abort,
],
);

Expand Down Expand Up @@ -321,7 +321,7 @@ export function usePromise<T extends FunctionReturningPromise | FunctionReturnin
}
}
},
[revalidate, latestValue, set],
[revalidate, latestValue, set, abort],
);

const onLoadMore = useCallback(() => {
Expand Down Expand Up @@ -349,7 +349,7 @@ export function usePromise<T extends FunctionReturningPromise | FunctionReturnin
return () => {
abort();
};
}, []);
}, [abort]);

// we only want to show the loading indicator if the promise is executing
const isLoading = options?.execute !== false ? state.isLoading : false;
Expand Down
Loading