From f47c9be102c45c243e3fa36485f5aa4bb02fb517 Mon Sep 17 00:00:00 2001 From: yyh Date: Fri, 26 Dec 2025 17:15:29 +0800 Subject: [PATCH] simplify plugin installation query hook --- web/hooks/use-query-params.ts | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/web/hooks/use-query-params.ts b/web/hooks/use-query-params.ts index 2e1e38daab..d909877422 100644 --- a/web/hooks/use-query-params.ts +++ b/web/hooks/use-query-params.ts @@ -184,7 +184,7 @@ const parseAsBundleInfo = createParser({ * setInstallState(null) // Clears installation params */ export function usePluginInstallation() { - const [installState, setInstallStateState] = useQueryStates( + return useQueryStates( { packageId: parseAsPackageId, bundleInfo: parseAsBundleInfo, @@ -196,32 +196,6 @@ export function usePluginInstallation() { }, }, ) - - const setInstallState = useCallback( - (state: { packageId?: string, bundleInfo?: BundleInfoQuery } | null) => { - if (!state) { - setInstallStateState(null) - return - } - const patch: { packageId?: string, bundleInfo?: BundleInfoQuery } = {} - if (state.packageId) - patch.packageId = state.packageId - if (state.bundleInfo) - patch.bundleInfo = state.bundleInfo - if (Object.keys(patch).length === 0) - return - setInstallStateState(patch) - }, - [setInstallStateState], - ) - - return [ - { - packageId: installState.packageId, - bundleInfo: installState.bundleInfo, - }, - setInstallState, - ] as const } /**