Merge pull request #1521 from yni9ht/fix-mount-update

refactor(mount): streamline mount update logic and improve readability
This commit is contained in:
Mauricio Siu 2025-04-26 16:50:09 -06:00 committed by GitHub
commit 6f47999a2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View File

@ -83,15 +83,15 @@ export const ComposeFileEditor = ({ composeId }: Props) => {
// Add keyboard shortcut for Ctrl+S/Cmd+S
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
if ((e.ctrlKey || e.metaKey) && e.key === 's' && !isLoading) {
if ((e.ctrlKey || e.metaKey) && e.key === "s" && !isLoading) {
e.preventDefault();
form.handleSubmit(onSubmit)();
}
};
document.addEventListener('keydown', handleKeyDown);
document.addEventListener("keydown", handleKeyDown);
return () => {
document.removeEventListener('keydown', handleKeyDown);
document.removeEventListener("keydown", handleKeyDown);
};
}, [form, onSubmit, isLoading]);

View File

@ -31,7 +31,6 @@ export const mountRouter = createTRPCRouter({
update: protectedProcedure
.input(apiUpdateMount)
.mutation(async ({ input }) => {
await updateMount(input.mountId, input);
return true;
return await updateMount(input.mountId, input);
}),
});

View File

@ -144,7 +144,8 @@ export const updateMount = async (
await deleteFileMount(mountId);
await createFileMount(mountId);
}
return mount;
return await findMountById(mountId);
});
};