mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-19 08:59:11 +00:00
fix: app going blank when the last library is deleted (#1814)
fix app going blank when the last library is deleted
This commit is contained in:
parent
e3c2c9022b
commit
98c0004c10
|
@ -1,4 +1,5 @@
|
|||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { useNavigate } from 'react-router';
|
||||
import { useBridgeMutation, usePlausibleEvent, useZodForm } from '@sd/client';
|
||||
import { Dialog, useDialog, UseDialogProps } from '@sd/ui';
|
||||
import { usePlatform } from '~/util/Platform';
|
||||
|
@ -11,6 +12,7 @@ export default function DeleteLibraryDialog(props: Props) {
|
|||
const submitPlausibleEvent = usePlausibleEvent();
|
||||
const queryClient = useQueryClient();
|
||||
const platform = usePlatform();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const deleteLib = useBridgeMutation('library.delete');
|
||||
|
||||
|
@ -29,6 +31,8 @@ export default function DeleteLibraryDialog(props: Props) {
|
|||
type: 'libraryDelete'
|
||||
}
|
||||
});
|
||||
|
||||
navigate('/');
|
||||
} catch (e) {
|
||||
alert(`Failed to delete library: ${e}`);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ export default function OnboardingNewLibrary() {
|
|||
</OnboardingDescription>
|
||||
|
||||
{importMode ? (
|
||||
<div className="space-x-2 mt-7">
|
||||
<div className="mt-7 space-x-2">
|
||||
<Button onClick={handleImport} variant="accent" size="sm">
|
||||
Import
|
||||
</Button>
|
||||
|
@ -53,7 +53,7 @@ export default function OnboardingNewLibrary() {
|
|||
placeholder={'e.g. "James\' Library"'}
|
||||
/>
|
||||
<div className="flex grow" />
|
||||
<div className="space-x-2 mt-7">
|
||||
<div className="mt-7 space-x-2">
|
||||
<Button
|
||||
type="submit"
|
||||
variant="accent"
|
||||
|
|
Loading…
Reference in a new issue