Fix Ask AI submissions when search state is empty (#4651)

This commit is contained in:
Surai
2026-09-30 09:50:39 +02:00
committed by GitHub
parent 61992424af
commit 9f5290bccc
2 changed files with 12 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"gitbook": patch
---
Fix inline Ask AI inputs and buttons doing nothing before search is opened.
+7 -3
View File
@@ -119,9 +119,13 @@ export function useAI(): AIContext {
icon: <AISearchIcon />,
open: (query?: string) => {
if (query) {
setSearchState((prev) =>
prev ? { ...prev, query: null, ask: query, open: true } : null
);
setSearchState((prev) => ({
...prev,
query: null,
ask: query,
scope: prev?.scope ?? 'default',
open: true,
}));
}
},
pageAction: false,