Skip to content

Commit 5e1a77b

Browse files
committed
feat: Add signal parameter to getPluginsDetail function
1 parent 49867df commit 5e1a77b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Shared/Components/Plugin/service.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const getPluginsDetail = async ({
1717
appId,
1818
parentPluginIds,
1919
pluginIds,
20+
signal,
2021
shouldShowError = true,
2122
}: PluginDetailServiceParamsType): Promise<Pick<GetPluginStoreDataReturnType, 'pluginStore'>> => {
2223
try {
@@ -28,6 +29,7 @@ export const getPluginsDetail = async ({
2829

2930
const { result } = await get<PluginDetailDTO>(
3031
getUrlWithSearchParams(ROUTES.PLUGIN_GLOBAL_LIST_DETAIL_V2, payload),
32+
{ signal },
3133
)
3234

3335
const pluginStore = parsePluginDetailsDTOIntoPluginStore(result?.parentPlugins)
@@ -36,7 +38,7 @@ export const getPluginsDetail = async ({
3638
pluginStore,
3739
}
3840
} catch (error) {
39-
if (shouldShowError) {
41+
if (shouldShowError && !getIsRequestAborted(error)) {
4042
showError(error)
4143
}
4244
throw error

src/Shared/Components/Plugin/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export interface PluginDetailServiceParamsType {
6969
* @default true
7070
*/
7171
shouldShowError?: boolean
72+
signal?: AbortSignal
7273
}
7374

7475
export interface PluginDetailPayloadType extends Pick<PluginDetailServiceParamsType, 'appId'> {

0 commit comments

Comments
 (0)