Skip to content

Commit 1e7da6d

Browse files
committed
fix(sidebar): use data-first pattern for tasks loading guard
1 parent e316c44 commit 1e7da6d

1 file changed

Lines changed: 3 additions & 7 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 & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -789,18 +789,14 @@ export const Sidebar = memo(function Sidebar() {
789789
)
790790
}
791791

792-
const {
793-
data: fetchedTasks = [],
794-
isPending: tasksPending,
795-
isError: tasksError,
796-
} = useTasks(workspaceId)
797-
const tasksLoading = tasksPending || tasksError
792+
const { data: fetchedTasks } = useTasks(workspaceId)
793+
const tasksLoading = fetchedTasks === undefined
798794

799795
useTaskEvents(workspaceId)
800796

801797
const tasks = useMemo(
802798
() =>
803-
fetchedTasks.length > 0
799+
fetchedTasks && fetchedTasks.length > 0
804800
? fetchedTasks.map((t) => ({
805801
...t,
806802
href: `/workspace/${workspaceId}/task/${t.id}`,

0 commit comments

Comments
 (0)