Skip to content

Commit

Permalink
fix node label ffrom different branch
Browse files Browse the repository at this point in the history
  • Loading branch information
pa-lem committed Mar 4, 2025
1 parent ce9a1fd commit d0f7e78
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion frontend/app/src/entities/events/ui/global-group-event.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const GroupEvent = (props: EventNodeInterface) => {
<Icon icon="mdi:group" className="text-gray-400" />

<div className="text-black font-semibold">
<NodeLabel id={account_id} kind="CoreAccount" />
<NodeLabel id={account_id} kind="CoreAccount" branch={props.branch} />
</div>

{(GROUP_EVENTS_MAPPING[event] && GROUP_EVENTS_MAPPING[event](props)) ?? event}
Expand Down
2 changes: 2 additions & 0 deletions frontend/app/src/entities/events/ui/global-node-event.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const NodeEvent = (props: NodeMutatedEvent) => {
<NodeLabel
id={props.primary_node.id}
kind={props.primary_node?.kind}
branch={props.branch}
className="overflow-hidden text-ellipsis whitespace-nowrap"
/>
) : (
Expand All @@ -67,6 +68,7 @@ export const NodeEvent = (props: NodeMutatedEvent) => {
<NodeLabel
id={props.primary_node.id}
kind={props.primary_node?.kind}
branch={props.branch}
className="overflow-hidden text-ellipsis whitespace-nowrap"
/>
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { queryOptions, useQuery } from "@tanstack/react-query";
import { useAtomValue } from "jotai";
import { getNodeLabelFromApi } from "./get-display-label";

type NodeLabelProps = { objectid?: string; kind: string; enabled?: boolean };
type NodeLabelProps = { objectid?: string; kind: string; enabled?: boolean; branch?: string };

export function getNodeLabelQueryOptions({
objectid,
Expand All @@ -28,7 +28,7 @@ export function getNodeLabelQueryOptions({
});
}

export const useNodeLabel = ({ objectid, kind, enabled }: NodeLabelProps) => {
export const useNodeLabel = ({ objectid, kind, enabled, branch }: NodeLabelProps) => {
const { currentBranch } = useCurrentBranch();
const timeMachineDate = useAtomValue(datetimeAtom);

Expand All @@ -37,7 +37,7 @@ export const useNodeLabel = ({ objectid, kind, enabled }: NodeLabelProps) => {
objectid,
kind,
enabled,
branchName: currentBranch.name,
branchName: branch ?? currentBranch.name,
atDate: timeMachineDate,
})
);
Expand Down
5 changes: 3 additions & 2 deletions frontend/app/src/entities/nodes/object/ui/node-label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import { useNodeLabel } from "../api/get-display-label.query";
type NodeLabelProps = {
id?: string;
kind?: string;
branch?: string;
className?: string;
};

export const NodeLabel = ({ id, kind = NODE_OBJECT, className }: NodeLabelProps) => {
const { isLoading, error, data } = useNodeLabel({ objectid: id, kind, enabled: !!id });
export const NodeLabel = ({ id, kind = NODE_OBJECT, branch, className }: NodeLabelProps) => {
const { isLoading, error, data } = useNodeLabel({ objectid: id, kind, enabled: !!id, branch });

if (isLoading) {
return <Skeleton className="h-3 w-14" />;
Expand Down

0 comments on commit d0f7e78

Please sign in to comment.