#
luxiaotao1123
2024-10-18 fd1c390222642abd57e0662d2328a008d0a0c845
zy-acs-flow/src/map/insight/agv/useCoolHook.js
@@ -22,6 +22,7 @@
                })))
            } else {
                console.error(msg);
                setOptions([]);
            }
        } catch (error) {
            console.error(error.message);
@@ -32,16 +33,21 @@
    const debouncedFetch = useCallback(debounce(fetchData, 300), [url]);
    useEffect(() => {
        if (inputValue) {
            debouncedFetch(inputValue);
        } else {
            setOptions([]);
        }
        // console.log(inputValue, url)
        // if (inputValue) {
        //     debouncedFetch(inputValue);
        // } else {
        //     setOptions([]);
        // }
        debouncedFetch(inputValue);
    }, [inputValue, debouncedFetch]);
    const resetInput = () => setInputValue('');
    return {
        options,
        setInputValue,
        resetInput,
    };
}