diff options
| author | Dhravya Shah <[email protected]> | 2024-08-07 18:07:34 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-08-07 18:07:34 -0700 |
| commit | bfb0e86d765d06ca4caf1cef478d2dc831bc56e2 (patch) | |
| tree | cabda310a033e96b313fb5f067106fe5b901960a | |
| parent | Merge pull request #229 from supermemoryai/fix/extension-nav (diff) | |
| parent | fixes multiple memory submission bug (diff) | |
| download | supermemory-bfb0e86d765d06ca4caf1cef478d2dc831bc56e2.tar.xz supermemory-bfb0e86d765d06ca4caf1cef478d2dc831bc56e2.zip | |
Merge pull request #230 from Yh010/bug/multiButtonPress
fixes #146 multiple memory submission bug
| -rw-r--r-- | apps/web/app/(dash)/menu.tsx | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/apps/web/app/(dash)/menu.tsx b/apps/web/app/(dash)/menu.tsx index f9363efb..b8bd25cc 100644 --- a/apps/web/app/(dash)/menu.tsx +++ b/apps/web/app/(dash)/menu.tsx @@ -31,10 +31,20 @@ import ComboboxWithCreate from "@repo/ui/shadcn/combobox"; import { StoredSpace } from "@repo/db/schema"; import useMeasure from "react-use-measure"; import { useKeyPress } from "@/lib/useKeyPress"; +import { useFormStatus } from "react-dom"; function Menu() { const [spaces, setSpaces] = useState<StoredSpace[]>([]); + function SubmitButton() { + const status = useFormStatus(); + return ( + <Button disabled={status.pending} variant={"secondary"} type="submit"> + Save {autoDetectedType != "none" && autoDetectedType} + </Button> + ); + } + useEffect(() => { (async () => { let spaces = await getSpaces(); @@ -319,13 +329,7 @@ function Menu() { </div> <DialogFooter> - <Button - disabled={autoDetectedType === "none"} - variant={"secondary"} - type="submit" - > - Save {autoDetectedType != "none" && autoDetectedType} - </Button> + <SubmitButton /> </DialogFooter> </form> </DialogContent> |