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): fixed view execution logs button triggering the workflow #7335

Open
wants to merge 1 commit into
base: nv-5073-digest-schema-updates
Choose a base branch
from

Conversation

LetItRock
Copy link
Contributor

What changed? Why was the change needed?

Workflow Trigger - Activity Log:
Fixed the issue with the View Execution button that was triggering the workflow.

Screenshots

Screen.Recording.2024-12-19.at.15.38.44.mov

@@ -59,7 +51,7 @@ export const TestWorkflowLogsSidebar = ({ transactionId }: TestWorkflowLogsSideb
) : activityId ? (
<ActivityPanel
activityId={activityId}
onActivitySelect={() => {}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not implemented at all and the click on View Execution was triggering the workflow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, missed this during the smaller PR's split

Comment on lines +27 to +29
if (activityId) {
setShouldRefetch(false);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refetch the activities (notifications) until we have some by the transactionId. We need to refetch because the worker doesn't create them right away, but processes after some time depending on where the jobs are in the queue.

Comment on lines +32 to +50
const { activity, isPending, error } = useFetchActivity(
{ activityId },
{
refetchInterval: shouldRefetch ? 1000 : false,
}
);

useEffect(() => {
if (!activity) return;

const isPending = activity.jobs?.some((job) => job.status === JobStatusEnum.PENDING);

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

queryClient.invalidateQueries({
queryKey: [QueryKeys.fetchActivity, currentEnvironment?._id, activityId],
});
}, [activity, queryClient, currentEnvironment, activityId]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refetch the activity details until we have any pending jobs

Comment on lines +107 to +108
e.stopPropagation();
e.preventDefault();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't propagate click event

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LetItRock I've faced this issue already on other multiple product areas. Wdyt if we change the primitive Button component to have type="button", so it won't be treated as type submit when wrapped in a form?

Copy link
Contributor

@scopsy scopsy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Did you had a chance to also test the activity feed page for regressions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants