Skip to content

Commit 4a410c8

Browse files
committed
fix: ensure worker deletion handles null worker case and invalidate cache
1 parent 27f7068 commit 4a410c8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/client/routes/worker/$workerId/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ function PageComponent() {
8282
const [activePreviewParams, setActivePreviewParams] = useState<UrlParam[]>([
8383
{ key: '', value: '' },
8484
]);
85+
const trpcUtils = trpc.useUtils();
8586

8687
const {
8788
data: worker,
@@ -136,12 +137,15 @@ function PageComponent() {
136137
});
137138

138139
const handleDelete = useEvent(async () => {
139-
if (!worker) return;
140+
if (!worker) {
141+
return;
142+
}
140143

141144
await deleteMutation.mutateAsync({
142145
workspaceId,
143146
workerId: worker.id,
144147
});
148+
trpcUtils.worker.all.invalidate();
145149

146150
navigate({
147151
to: '/worker',

0 commit comments

Comments
 (0)