Fix logic

This commit is contained in:
Nicolas Mowen 2024-09-12 08:33:39 -06:00
parent 4cbabdcc39
commit e832ba57fe
2 changed files with 10 additions and 4 deletions

View File

@ -87,12 +87,14 @@ export default function SearchDetailDialog({
}, [config, search]);
useEffect(() => {
if (!searchTabs.includes(page)) {
if (searchTabs.length == 0) {
return;
}
if (!searchTabs.includes(pageToggle)) {
setPage("details");
}
// we know that these deps are correct
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [searchTabs]);
}, [pageToggle, searchTabs]);
if (!search) {
return;

View File

@ -1,4 +1,5 @@
import copy from "copy-to-clipboard";
import { toast } from "sonner";
export function shareOrCopy(url: string, title?: string) {
if (window.isSecureContext && "share" in navigator) {
@ -8,5 +9,8 @@ export function shareOrCopy(url: string, title?: string) {
});
} else {
copy(url);
toast.success("Copied to clipboard.", {
position: "top-center",
});
}
}