We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I using the following hook watch a folder:
function isInterest(e: WatchEventKind) { // @ts-expect-error: xxx return e.create | e.modify | e.remove; } let oldChangeTime = ''; export function useFolderChanges() { const [path] = useAppStore(s => [s.path]); const [count, setCount] = useState(0); const [handle, setHandle] = useState<UnwatchFn | null>(null); useEffect(() => { if (!path || path.length === 0) { if (handle !== null) { handle(); setHandle(null); } return; } if (path === oldChangeTime) { return; } oldChangeTime = path; (async () => { debug(`watch ${path}`); const h = await watch( path, e => { if (isInterest(e.type)) { setCount(count => { return count + 1; }); } }, { delayMs: 100, recursive: true, }, ); setHandle(s => { if (s !== null) { debug('cancel watch'); s(); } return h; }); })(); }, [path]); return count; }
However, when I refresh webpage. Then memory will leak:
notify-rs/notify#672
The text was updated successfully, but these errors were encountered:
tauri-apps/tauri#10266
Sorry, something went wrong.
tauri-apps/tauri#12388
No branches or pull requests
When I using the following hook watch a folder:
However, when I refresh webpage. Then memory will leak:
ref
notify-rs/notify#672
The text was updated successfully, but these errors were encountered: