-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Failed event deliveries list #5163
Conversation
🦋 Changeset detectedLatest commit: 8205136 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
src/apps/components/AppWebhooksDisplay/AppWebhooksAttemptDetails.tsx
Outdated
Show resolved
Hide resolved
export const EventDeliveriesList: React.FC<EventDeliveriesListProps> = ({ eventDeliveries }) => ( | ||
<> | ||
{eventDeliveries.map((ed, index) => { | ||
const { createdAt, id } = ed.node; | ||
const attempts = ed.node.attempts?.edges?.map(({ node }) => node) ?? []; | ||
const attemptsCount = attempts.length; | ||
const lastAttemptDate = attempts[attemptsCount - 1]?.createdAt; | ||
const hasMore = index < eventDeliveries.length - 1; | ||
|
||
return ( | ||
<EventDeliveryItem | ||
key={id} | ||
dataTestId={id} | ||
createdAt={createdAt} | ||
status={ed.node.status} | ||
attemptsCount={attemptsCount} | ||
attempts={attempts} | ||
lastAttemptDate={lastAttemptDate} | ||
hasMore={hasMore} | ||
/> | ||
); | ||
})} | ||
</> | ||
); |
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.
In cases like this you could create something like DeliveryItem class or (even function + interfcace) and EventDeliveryItem component could take a single argument of this type.
That class can have static method eg. createFrom(deliveryEntry: DeliveryEntry)
- in that case you have elegant separation and you are able to simply call:
{eventDeliveries.map(entry => <EventDeliveryItem deliveryItem={DeliveryItem.from(entry)} />)}
and this component is not needed anymore.
Think about that in the future, not needed now.
dataTestId?: string; | ||
} | ||
|
||
const MAX_ATTEMPTS = 6; |
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.
would be nice to link some docs here so we know where this value come from
* improve app install loading state * tiny ui fix * failed event delivery list in app details * changeset * fix types * add tests * fix type * cr fixes * ui fixes * remove unused import
What type of PR is this?
Related Issues or Documents
Usage Instructions, Screenshots, Recordings
App install loading state:
Have you written tests?
[Optional] Description