mirror of
https://github.com/moghtech/komodo.git
synced 2026-07-27 17:56:33 -05:00
improve recently viewed to avoid calling conditionally
This commit is contained in:
@@ -106,7 +106,7 @@ export const useServerStats = (server_id: string) => {
|
||||
|
||||
export const useAddRecentlyViewed = (
|
||||
type: Types.ResourceTarget["type"],
|
||||
id: string
|
||||
id: string | undefined
|
||||
) => {
|
||||
const invalidate = useInvalidate();
|
||||
const push = useWrite("PushRecentlyViewed", {
|
||||
@@ -114,8 +114,8 @@ export const useAddRecentlyViewed = (
|
||||
}).mutate;
|
||||
|
||||
useEffect(() => {
|
||||
push({ resource: { type, id } } as any);
|
||||
}, []);
|
||||
id && push({ resource: { type, id } });
|
||||
}, [id]);
|
||||
|
||||
return push;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user