Skip to content

Commit 31a4006

Browse files
committed
fix(sidebar): remove mutation objects from useCallback deps
Mutation objects are not referentially stable in TanStack Query v5 — only .mutate() and .mutateAsync() are stable. Removed deleteTaskMutation, deleteTasksMutation, markTaskReadMutation, and markTaskUnreadMutation from their respective useCallback dependency arrays to avoid unnecessary recreations on every mutation state update.
1 parent b7f7a1d commit 31a4006

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/w/components/sidebar

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ export const Sidebar = memo(function Sidebar() {
896896
deleteTasksMutation.mutate(taskIdsToDelete, { onSuccess: onDeleteSuccess })
897897
}
898898
setIsTaskDeleteModalOpen(false)
899-
}, [pathname, workspaceId, deleteTaskMutation, deleteTasksMutation, navigateToPage])
899+
}, [pathname, workspaceId, navigateToPage])
900900

901901
const [visibleTaskCount, setVisibleTaskCount] = useState(5)
902902
const taskFlyoutRename = useFlyoutInlineRename({
@@ -935,13 +935,13 @@ export const Sidebar = memo(function Sidebar() {
935935
const { taskIds: ids } = contextMenuSelectionRef.current
936936
if (ids.length !== 1) return
937937
markTaskReadMutation.mutate(ids[0])
938-
}, [markTaskReadMutation])
938+
}, [])
939939

940940
const handleMarkTaskAsUnread = useCallback(() => {
941941
const { taskIds: ids } = contextMenuSelectionRef.current
942942
if (ids.length !== 1) return
943943
markTaskUnreadMutation.mutate(ids[0])
944-
}, [markTaskUnreadMutation])
944+
}, [])
945945

946946
const handleStartTaskRename = useCallback(() => {
947947
const { taskIds: ids } = contextMenuSelectionRef.current

0 commit comments

Comments
 (0)