Skip to content

Commit

Permalink
Make autocomplete always available (#7326)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshiokatsuneo authored Feb 13, 2025
1 parent 925bb91 commit 53eab14
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions client/app/pages/queries/hooks/useAutocompleteFlags.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import { useCallback, useMemo, useState } from "react";
import { reduce } from "lodash";
import localOptions from "@/lib/localOptions";

function calculateTokensCount(schema) {
return reduce(schema, (totalLength, table) => totalLength + table.columns.length, 0);
}

export default function useAutocompleteFlags(schema) {
const isAvailable = useMemo(() => calculateTokensCount(schema) <= 5000, [schema]);
const isAvailable = true;
const [isEnabled, setIsEnabled] = useState(localOptions.get("liveAutocomplete", true));

const toggleAutocomplete = useCallback(state => {
const toggleAutocomplete = useCallback((state) => {
setIsEnabled(state);
localOptions.set("liveAutocomplete", state);
}, []);
Expand Down

0 comments on commit 53eab14

Please sign in to comment.