diff options
| author | MohamedBassem <me@mbassem.com> | 2024-04-09 15:49:24 +0100 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-04-09 15:49:24 +0100 |
| commit | fe13408831dce4bdae4911098d6079a097cae9e8 (patch) | |
| tree | 228bbb192b3a0f3417a4526c382b0a3ddf7e04ff /apps/web/components/dashboard/bookmarks/EditorCard.tsx | |
| parent | 994691b02515dfb579a5c3618631065bd76b9e4b (diff) | |
| download | karakeep-fe13408831dce4bdae4911098d6079a097cae9e8.tar.zst | |
feature(web): Allow uploading directly into lists/tags. Fixes #69
Diffstat (limited to 'apps/web/components/dashboard/bookmarks/EditorCard.tsx')
| -rw-r--r-- | apps/web/components/dashboard/bookmarks/EditorCard.tsx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/apps/web/components/dashboard/bookmarks/EditorCard.tsx b/apps/web/components/dashboard/bookmarks/EditorCard.tsx index b9e46a30..10ad1f13 100644 --- a/apps/web/components/dashboard/bookmarks/EditorCard.tsx +++ b/apps/web/components/dashboard/bookmarks/EditorCard.tsx @@ -7,12 +7,13 @@ import { Separator } from "@/components/ui/separator"; import { Textarea } from "@/components/ui/textarea"; import { toast } from "@/components/ui/use-toast"; import { useClientConfig } from "@/lib/clientConfig"; -import { api } from "@/lib/trpc"; import { cn } from "@/lib/utils"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { z } from "zod"; +import { useCreateBookmarkWithPostHook } from "@hoarder/shared-react/hooks/bookmarks"; + function useFocusOnKeyPress(inputRef: React.RefObject<HTMLTextAreaElement>) { useEffect(() => { function handleKeyPress(e: KeyboardEvent) { @@ -47,10 +48,8 @@ export default function EditorCard({ className }: { className?: string }) { useImperativeHandle(ref, () => inputRef.current); useFocusOnKeyPress(inputRef); - const invalidateBookmarksCache = api.useUtils().bookmarks.invalidate; - const { mutate, isPending } = api.bookmarks.createBookmark.useMutation({ + const { mutate, isPending } = useCreateBookmarkWithPostHook({ onSuccess: () => { - invalidateBookmarksCache(); form.reset(); }, onError: () => { |
