mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(site/src): replace misused useEffectEvent with correct patterns (#24525)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { type FC, useEffect, useEffectEvent } from "react";
|
||||
import { type FC, useCallback, useEffect } from "react";
|
||||
import { useMutation, useQuery, useQueryClient } from "react-query";
|
||||
import { toast } from "sonner";
|
||||
import { watchInboxNotifications } from "#/api/api";
|
||||
@@ -40,7 +40,7 @@ export const NotificationsInbox: FC<NotificationsInboxProps> = ({
|
||||
queryFn: () => fetchNotifications(),
|
||||
});
|
||||
|
||||
const updateNotificationsCache = useEffectEvent(
|
||||
const updateNotificationsCache = useCallback(
|
||||
async (
|
||||
callback: (
|
||||
res: ListInboxNotificationsResponse,
|
||||
@@ -57,6 +57,7 @@ export const NotificationsInbox: FC<NotificationsInboxProps> = ({
|
||||
},
|
||||
);
|
||||
},
|
||||
[queryClient],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -85,7 +86,7 @@ export const NotificationsInbox: FC<NotificationsInboxProps> = ({
|
||||
});
|
||||
|
||||
return () => socket.close();
|
||||
}, []);
|
||||
}, [updateNotificationsCache]);
|
||||
|
||||
const {
|
||||
mutate: loadMoreNotifications,
|
||||
|
||||
Reference in New Issue
Block a user