mirror of
https://github.com/patarapolw/cjdic2.git
synced 2026-11-08 17:35:18 +00:00
is init yet from Rust
This commit is contained in:
1 parent
9b5ae1cd8b
commit
dcfe074535
9 files changed
+38
-91
No files matched your search
@@ -1,12 +1,15 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { Dialog, Portal } from "@chakra-ui/react";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
|
||||
function LoadingDialog() {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setIsLoading(true);
|
||||
invoke<boolean>("is_yomitan_setup_yet").then((is_setup) =>
|
||||
setIsLoading(!is_setup),
|
||||
);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
||||
@@ -29,19 +29,25 @@ function SearchPage() {
|
||||
trySearch();
|
||||
}, [q]);
|
||||
|
||||
async function trySearch() {
|
||||
function trySearch() {
|
||||
if (!q.trim()) {
|
||||
setEntries([]);
|
||||
return;
|
||||
}
|
||||
|
||||
let willRunSearch = runSearch;
|
||||
|
||||
if (searchTimeout) {
|
||||
clearTimeout(searchTimeout);
|
||||
} else {
|
||||
// If new, just run immediately. No need for throttling.
|
||||
runSearch();
|
||||
willRunSearch = async () => {};
|
||||
}
|
||||
|
||||
setSearchTimeout(
|
||||
setTimeout(() => {
|
||||
runSearch();
|
||||
willRunSearch();
|
||||
}, 250),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user