-
Notifications
You must be signed in to change notification settings - Fork 672
fix: acknowledge a new run ahead of outcome banners #15067
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
Changes from all commits
c9440fc
4ffade4
45b02fe
7cdc3cf
ae7af90
f6bdd98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,12 @@ export type QueueNotificationBanner = | |
| | QueueCompletedNotification | ||
| | QueueFailedNotification | ||
|
|
||
| const isRunAcknowledgement = (notification: QueueNotificationBanner) => | ||
| notification.type === 'queuedPending' || notification.type === 'queued' | ||
|
|
||
| const isOutcome = (notification: QueueNotificationBanner) => | ||
| notification.type === 'completed' || notification.type === 'failed' | ||
|
|
||
| const sanitizeCount = (value: number | undefined) => { | ||
| if (!(typeof value === 'number' && value > 0)) { | ||
| return 1 | ||
|
|
@@ -101,8 +107,36 @@ export const useQueueNotificationBanners = () => { | |
| ) | ||
| } | ||
|
|
||
| const queuePositionFor = (notification: QueueNotificationBanner) => { | ||
| if (!isRunAcknowledgement(notification)) { | ||
| return pendingNotifications.value.length | ||
| } | ||
| const firstOutcome = pendingNotifications.value.findIndex(isOutcome) | ||
| return firstOutcome === -1 | ||
| ? pendingNotifications.value.length | ||
| : firstOutcome | ||
| } | ||
|
|
||
| const queueNotification = (notification: QueueNotificationBanner) => { | ||
| pendingNotifications.value = [...pendingNotifications.value, notification] | ||
| if (isRunAcknowledgement(notification)) { | ||
| const active = activeNotification.value | ||
| if (active === null || isOutcome(active)) { | ||
| clearDismissTimer() | ||
| activeNotification.value = null | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider requeueing the preempted outcome (
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your call, I approve if this is intended |
||
| pendingNotifications.value = [ | ||
| notification, | ||
| ...pendingNotifications.value | ||
| ] | ||
| showNextNotification() | ||
| return | ||
| } | ||
| } | ||
|
|
||
| pendingNotifications.value = pendingNotifications.value.toSpliced( | ||
| queuePositionFor(notification), | ||
| 0, | ||
| notification | ||
| ) | ||
| showNextNotification() | ||
| } | ||
|
|
||
|
|
||
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 also passes on the pre-fix FIFO code: with no
expect.timeoutconfigured, the default 5s outlasts the ≤4s rotation of thefailedbanner. A tight timeout here (e.g.{ timeout: 1000 }) plus re-assertingfailedright before the dispatch would make it a real guard.