Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/features/window/hooks/use-deep-link.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { onOpenUrl } from "@tauri-apps/plugin-deep-link";
import { getCurrent, onOpenUrl } from "@tauri-apps/plugin-deep-link";
import { useEffect } from "react";
import { useExtensionStore } from "@/extensions/registry/extension-store";
import { toast } from "@/ui/toast";
Expand All @@ -19,13 +19,23 @@ import {
*/
export function useDeepLink() {
useEffect(() => {
let disposed = false;

void getCurrent().then((urls) => {
if (disposed || !urls) return;
for (const url of urls) {
handleDeepLink(url);
}
});

const unlisten = onOpenUrl((urls: string[]) => {
for (const url of urls) {
handleDeepLink(url);
}
});

return () => {
disposed = true;
unlisten.then((fn: () => void) => fn());
};
}, []);
Expand Down
Loading