🧹 fix: Order Enabled Guard After Config Expansion in useGetAgentByIdQuery (#13927)
Some checks are pending
Docker Dev Branch Images Build / build (Dockerfile, lc-dev, node) (push) Waiting to run
Docker Dev Branch Images Build / build (Dockerfile.multi, lc-dev-api, api-build) (push) Waiting to run
GitNexus Index / index (push) Waiting to run
GitNexus Index / post-index (push) Blocked by required conditions

Otherwise, it's possible for a config to override the `isValidAgentId` check.

Without that check, it's possible to query `getAgentById()` with a blank `agent_id`,
which can result in polluting the `QueryKeys.agent` cache with a full list of agents
(instead of just a single agent result).
This commit is contained in:
Dan Lew 2026-06-23 16:15:44 -05:00 committed by GitHub
parent 0a3448dcee
commit f09a1ad7fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -104,8 +104,8 @@ export const useGetAgentByIdQuery = (
refetchOnReconnect: false,
refetchOnMount: false,
retry: false,
enabled: isValidAgentId && (config?.enabled ?? true),
...config,
enabled: isValidAgentId && (config?.enabled ?? true),
},
);
};