some ui fix and debug input field, separate price field
This commit is contained in:
@@ -10,10 +10,18 @@ interface IToast extends Pick<ToastMessageOptions, 'sticky' | 'life'> {
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ToastService {
|
||||
private readonly dedupeWindowMs = 2000;
|
||||
private readonly recentMessages = new Map<string, number>();
|
||||
|
||||
constructor(private messageService: MessageService) {}
|
||||
|
||||
add(message: ToastMessageOptions) {
|
||||
if (!message.detail) return;
|
||||
const dedupeKey = `${message.severity ?? ''}|${message.summary ?? ''}|${message.detail}`;
|
||||
const now = Date.now();
|
||||
const lastShownAt = this.recentMessages.get(dedupeKey);
|
||||
if (lastShownAt && now - lastShownAt < this.dedupeWindowMs) return;
|
||||
this.recentMessages.set(dedupeKey, now);
|
||||
this.messageService.add(message);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user