-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
base: nv-5073-digest-schema-updates
Are you sure you want to change the base?
Conversation
@@ -59,7 +51,7 @@ export const TestWorkflowLogsSidebar = ({ transactionId }: TestWorkflowLogsSideb | |||
) : activityId ? ( | |||
<ActivityPanel | |||
activityId={activityId} | |||
onActivitySelect={() => {}} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
if (activityId) { | ||
setShouldRefetch(false); | ||
} |
There was a problem hiding this comment.
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.
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]); |
There was a problem hiding this comment.
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
e.stopPropagation(); | ||
e.preventDefault(); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this 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?
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