-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat(cmdk_v2): poc llm serv #98015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cmdk_v2): poc llm serv #98015
Conversation
❌ 5 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
| const res = await fetch(url, { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| body: JSON.stringify({ | ||
| query, | ||
| }), | ||
| }); | ||
| const data: LLMRoutingResult = await res.json(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential bug: The fetch call in useLLMRoutingDynamicActions lacks error handling. A failed network request will throw an unhandled exception, crashing the OmniSearch component and making it unusable.
-
Description: The
attemptRouteQueryfunction in theuseLLMRoutingDynamicActionshook executes afetchrequest to an external service without atry...catchblock or any other form of error handling. If this network request fails due to network issues, the service being unavailable, or if the service returns a non-JSON response, thefetchorres.json()call will throw an unhandled error. Because this hook is called unconditionally during the render cycle of theOmniSearchPalette, the unhandled exception will propagate up and likely crash the component, rendering the application's primary search functionality unusable. -
Suggested fix: Wrap the
fetchcall and the subsequentawait res.json()within atry...catchblock inside theattemptRouteQueryfunction. In thecatchblock, handle the error gracefully, for instance by logging it and ensuring theextraRouteActionsstate is set to an empty array to prevent a crash.
severity: 0.7, confidence: 0.9
Did we get this right? 👍 / 👎 to inform future reviews.
|
|
||
| useEffect(() => { | ||
| attemptRouteQuery(); | ||
| }, [attemptRouteQuery]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.