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): add missing payload on activity feed #7883

Open
wants to merge 21 commits into
base: next
Choose a base branch
from

Conversation

djabarovgeorge
Copy link
Contributor

@djabarovgeorge djabarovgeorge commented Mar 10, 2025

What changed? Why was the change needed?

Can be tested in preview deployment.

Screenshots

Expand for optional sections

Related enterprise PR

Special notes for your reviewer

Copy link

linear bot commented Mar 10, 2025

Copy link

netlify bot commented Mar 10, 2025

Deploy Preview for dashboard-v2-novu-staging failed. Why did it fail? →

Name Link
🔨 Latest commit ab863a5
🔍 Latest deploy log https://app.netlify.com/sites/dashboard-v2-novu-staging/deploys/67ceab78e4cd4d000969f65b

Copy link

netlify bot commented Mar 10, 2025

Deploy Preview for dashboard-v2-novu-staging canceled.

Name Link
🔨 Latest commit 49e7653
🔍 Latest deploy log https://app.netlify.com/sites/dashboard-v2-novu-staging/deploys/67d833cce3e41c0008be8b75

…ayload-in-activity-feed-item

# Conflicts:
#	libs/application-generic/src/usecases/message-template/create-message-template/create-message-template.usecase.ts
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure why i got formatting changes on the template store template in this PR ..

@djabarovgeorge djabarovgeorge changed the title fix(dashboard): wip add missing payload on activity feed fix(dashboard): add missing payload on activity feed Mar 18, 2025
Comment on lines +139 to +141
toast.error('Failed to trigger resend workflow', {
description: e instanceof Error ? e.message : 'There was an error triggering the resend workflow.',
});
Copy link
Contributor

Choose a reason for hiding this comment

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

please use showErrorToast

Comment on lines +111 to +113
toast.success('Notification resent successfully', {
description: `A new notification has been triggered with transaction ID: ${newTransactionId}`,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

please use showSuccessToast

Comment on lines +55 to +71
const setIsFullscreenOpen = useCallback((isOpen: boolean) => {
if (isOpen && popoverCloseRef.current) {
popoverCloseRef.current.click();
}

setIsFullscreenOpenState(isOpen);
}, []);

const closePopover = useCallback(() => {
if (popoverCloseRef.current) {
popoverCloseRef.current.click();
}

setIsPopoverOpen(false);
}, []);

const handleResend = useCallback(async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

if you pass these handlers to "simple" components (without deep tree and useMemo), then there is not much sense in memoization and useCallback

variant="secondary"
mode="ghost"
size="sm"
onClick={handleResend}
Copy link
Contributor

Choose a reason for hiding this comment

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

should not be allowed on deleted workflows, please do it in both places

<span className="text-foreground-950 text-sm font-medium">Logs</span>
</div>

{payload && (
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't the payload always available?

Comment on lines +87 to +105
return showToast({
variant: 'lg',
children: ({ close }) => (
<>
<ToastIcon variant="error" />
<div className="flex flex-col gap-2">
<span className="font-medium">Test workflow failed</span>
<span className="text-foreground-600 inline">
Workflow <span className="font-bold">{activity.template?.name}</span> cannot be triggered. Ensure that
it is active and requires not further actions.
</span>
</div>
<ToastClose onClick={close} />
</>
),
options: {
position: 'bottom-right',
},
});
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be an error or warning toast, please check showErrorToast

setIsPopoverOpen(false);
}, []);

const handleResend = useCallback(async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

please use the useMutation from @tanstack/react-query then you won't need to handle the loading flag and you will have onSuccess and onError callbacks to handle

@@ -55,33 +57,48 @@ export const TestWorkflowLogsSidebar = ({ transactionId, workflow }: TestWorkflo
}
}, [activityId]);

// Reset refetch when transaction ID changes
const handleTransactionIdChange = useCallback((newTransactionId: string) => {
setIsTransactionChanging(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure that this flag is needed, because the useFetchActivities query should be triggered and areActivitiesPending should be true resulting in the skeleton

<ActivityLogs
activity={activity}
onActivitySelect={setParentActivityId}
onTransactionIdChange={handleTransactionIdChange}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm missing the similar handling logic in the subscriber-activity-drawer.tsx

}
};

setTimeout(checkAndUpdateTransaction, 1000);
Copy link
Contributor

Choose a reason for hiding this comment

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

this one is a bit hacky, what if I have the other activities triggered at the same time? it might pick a wrong one

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