Skip to content

Commit

Permalink
fix: order pqir in the sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
srvEq committed Feb 14, 2025
1 parent 2dbcb9a commit 4ea784f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions components/canvas/Sidebar/SideBarBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { PQIRSection } from "./PQIRSection";
import styles from "./SidebarBody.module.scss";
import { CircularProgress, Typography } from "@equinor/eds-core-react";
import { unknownErrorToString } from "@/utils/isError";
import { useSelectedNodeForPQIR } from "../hooks/useSelectedNodeForPQIR";
import { Task } from "@/types/Task";

type SideBarBodyProps = {
selectedNode: NodeDataCommon;
Expand All @@ -15,11 +17,13 @@ export const SideBarBody = ({
userCanEdit,
}: SideBarBodyProps) => {
const { pqirs, isLoadingPQIRs, errorPQIRs } = usePQIRs();

const otherPQIRs = pqirs?.filter((pqir) =>
selectedNode.tasks.every(
(selectedNodePQIR) => selectedNodePQIR.id !== pqir.id
)
const selectedNodeForPQIR = useSelectedNodeForPQIR();
const otherPQIRs = pqirs?.filter(
(pqir) =>
selectedNodeForPQIR &&
selectedNodeForPQIR.data.tasks.every(
(selectedNodePQIR: Task) => selectedNodePQIR.id !== pqir.id
)
);

if (isLoadingPQIRs) {
Expand All @@ -33,7 +37,7 @@ export const SideBarBody = ({
<PQIRSection
title="Selected card's PQIRs"
emptyPQIRsText="This card has no PQIRs"
pqirs={selectedNode.tasks}
pqirs={selectedNodeForPQIR?.data?.tasks}
isSelectedSection
selectedNode={selectedNode}
userCanEdit={userCanEdit}
Expand Down

0 comments on commit 4ea784f

Please sign in to comment.