From 68df66120480a42fe1068dc9f38d90f1eaf64fa3 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Wed, 21 Jan 2026 21:40:02 +0000 Subject: [PATCH] Fix hook ordering for endpoint name resolution (#5517) ### Motivation - Prevent a React hook ordering issue by removing conditional `useCallback` usage in endpoint name resolution within the base parameters hook. ### Description - Replace conditional creation of `getEndpointName` with a single unconditional `useCallback` that reads `config.endpointName` and returns either the static string or calls the function with `parameters`, updating `frontend/src/core/hooks/tools/shared/useBaseParameters.ts`. ### Testing - No automated tests were executed in this change; please run `./gradlew build` (or confirm CI build) to verify the project compiles successfully. ------ [Codex Task](https://chatgpt.com/codex/tasks/task_b_696ec2829624832898fb4a92192ed548) --- .../core/hooks/tools/shared/useBaseParameters.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/frontend/src/core/hooks/tools/shared/useBaseParameters.ts b/frontend/src/core/hooks/tools/shared/useBaseParameters.ts index 941f8cdd2..099883c84 100644 --- a/frontend/src/core/hooks/tools/shared/useBaseParameters.ts +++ b/frontend/src/core/hooks/tools/shared/useBaseParameters.ts @@ -33,17 +33,13 @@ export function useBaseParameters(config: BaseParametersConfig): BaseParam return config.validateFn ? config.validateFn(parameters) : true; }, [parameters, config.validateFn]); - const endpointName = config.endpointName; - let getEndpointName: () => string; - if (typeof endpointName === "string") { - getEndpointName = useCallback(() => { + const getEndpointName = useCallback(() => { + const { endpointName } = config; + if (typeof endpointName === "string") { return endpointName; - }, []); - } else { - getEndpointName = useCallback(() => { - return endpointName(parameters); - }, [parameters]); - } + } + return endpointName(parameters); + }, [config.endpointName, parameters]); return { parameters,