Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dashboard): show more click triggers another trigger #7327

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export function ActivityJobItem({ job, isFirst, isLast }: ActivityJobItemProps)

<Button
variant="ghost"
type="button"
size="sm"
className="text-foreground-600 !mt-0 h-5 gap-0 p-0 leading-[12px] hover:bg-transparent"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ import { JobStatusEnum } from '@novu/shared';
import { Loader2 } from 'lucide-react';
import { WorkflowTriggerInboxIllustration } from '../../icons/workflow-trigger-inbox';
import { useFetchActivities } from '../../../hooks/use-fetch-activities';
import { QueryKeys } from '../../../utils/query-keys';
import { useEnvironment } from '../../../context/environment/hooks';
import { useQueryClient } from '@tanstack/react-query';

type TestWorkflowLogsSidebarProps = {
transactionId?: string;
};

export const TestWorkflowLogsSidebar = ({ transactionId }: TestWorkflowLogsSidebarProps) => {
const queryClient = useQueryClient();
const { currentEnvironment } = useEnvironment();
const [shouldRefetch, setShouldRefetch] = useState(true);
const { activities } = useFetchActivities(
{
Expand All @@ -28,7 +33,11 @@ export const TestWorkflowLogsSidebar = ({ transactionId }: TestWorkflowLogsSideb
const isPending = activity.jobs?.some((job) => job.status === JobStatusEnum.PENDING);

// Only stop refetching if we have an activity and it's not pending
setShouldRefetch(!activity || isPending);
setShouldRefetch(isPending);

queryClient.invalidateQueries({
queryKey: [QueryKeys.fetchActivity, currentEnvironment?._id, activity._id],
});
}, [activities]);

// Reset refetch when transaction ID changes
Expand Down
Loading