fix: fix website list not refresh when delete website problem
This commit is contained in:
parent
cc581f9c22
commit
fcb30a375b
@ -38,6 +38,7 @@ It's good to specialize in one thing, if we are experts in related abilities we
|
||||
- [ ] survey
|
||||
- [ ] lighthouse report
|
||||
- [ ] hooks
|
||||
- [ ] links
|
||||
|
||||
## Preview
|
||||
|
||||
|
@ -10,10 +10,8 @@ import { MonitorPicker } from '../monitor/MonitorPicker';
|
||||
import {
|
||||
defaultErrorHandler,
|
||||
defaultSuccessHandler,
|
||||
getQueryKey,
|
||||
trpc,
|
||||
} from '../../api/trpc';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { useEvent } from '../../hooks/useEvent';
|
||||
import { hostnameValidator } from '../../utils/validator';
|
||||
import { useTranslation } from '@i18next-toolkit/react';
|
||||
@ -25,7 +23,7 @@ export const WebsiteConfig: React.FC<{ websiteId: string }> = React.memo(
|
||||
const { t } = useTranslation();
|
||||
const workspaceId = useCurrentWorkspaceId();
|
||||
const navigate = useNavigate();
|
||||
const queryClient = useQueryClient();
|
||||
const trpcUtils = trpc.useUtils();
|
||||
|
||||
const { data: website, isLoading } = trpc.website.info.useQuery({
|
||||
workspaceId,
|
||||
@ -33,10 +31,7 @@ export const WebsiteConfig: React.FC<{ websiteId: string }> = React.memo(
|
||||
});
|
||||
|
||||
const updateMutation = trpc.website.updateInfo.useMutation({
|
||||
onSuccess: () => {
|
||||
queryClient.resetQueries(getQueryKey(trpc.website.info));
|
||||
defaultSuccessHandler();
|
||||
},
|
||||
onSuccess: defaultSuccessHandler,
|
||||
onError: defaultErrorHandler,
|
||||
});
|
||||
|
||||
@ -49,6 +44,11 @@ export const WebsiteConfig: React.FC<{ websiteId: string }> = React.memo(
|
||||
domain: values.domain,
|
||||
monitorId: values.monitorId,
|
||||
});
|
||||
|
||||
trpcUtils.website.info.refetch({
|
||||
workspaceId,
|
||||
websiteId,
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
@ -57,6 +57,8 @@ export const WebsiteConfig: React.FC<{ websiteId: string }> = React.memo(
|
||||
|
||||
message.success(t('Delete Success'));
|
||||
|
||||
await trpcUtils.website.all.refetch({ workspaceId });
|
||||
|
||||
navigate({
|
||||
to: '/website',
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { createRootRouteWithContext, Outlet } from '@tanstack/react-router';
|
||||
import { TanStackRouterDevtools } from '@tanstack/router-devtools';
|
||||
// import { TanStackRouterDevtools } from '@tanstack/router-devtools';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
interface RouterContext {
|
||||
@ -13,7 +13,8 @@ export const Route = createRootRouteWithContext<RouterContext>()({
|
||||
// https://github.com/TanStack/router/issues/857
|
||||
<Suspense fallback={null}>
|
||||
<Outlet />
|
||||
<TanStackRouterDevtools position="bottom-right" />
|
||||
|
||||
{/* <TanStackRouterDevtools position="bottom-right" /> */}
|
||||
</Suspense>
|
||||
);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user