Skip to content

Commit

Permalink
fix: Focus lost after modifying filter or search params (#696)
Browse files Browse the repository at this point in the history
Signed-off-by: ryjiang <[email protected]>
  • Loading branch information
shanghaikid authored Nov 15, 2024
1 parent 67e87f7 commit a6511e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
16 changes: 2 additions & 14 deletions client/src/pages/databases/collections/search/VectorInputBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,6 @@ export default function VectorInputBox(props: VectorInputBoxProps) {
onChangeRef.current = onChange;
fieldRef.current = field;
searchParamsRef.current = searchParams;

if (editor.current) {
// only data replace should trigger this, otherwise, let cm handle the state
if (editor.current.state.doc.toString() !== data) {
editor.current.dispatch({
changes: {
from: 0,
to: data.length + 1,
insert: data,
},
});
}
}
}, [JSON.stringify(searchParams), onChange]);

const getVectorById = (text: string) => {
Expand Down Expand Up @@ -293,14 +280,15 @@ export default function VectorInputBox(props: VectorInputBoxProps) {
editor.current.dispatch({
selection: { anchor: endPos },
});

editor.current.focus();

return () => {
view.destroy();
editor.current = undefined;
};
}
}, [JSON.stringify(field), getVectorById]);
}, [JSON.stringify({ field, data })]);

useEffect(() => {
// dispatch dark mode change to editor
Expand Down
1 change: 0 additions & 1 deletion client/src/pages/search/SearchParams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ const SearchParams: FC<SearchParamsProps> = ({
isInt: false,
required: false,
handleChange: value => {
console.log(value, typeof value);
handleInputChange('radius', value);
},
className: classes.inlineInput,
Expand Down

0 comments on commit a6511e3

Please sign in to comment.