Debounce duplicate Notice (toast) popup notifications

Proposed small Quality of Life change

Instead of endless identical Toasts when a message gets repeated quickly e.g.

How about storing the last message in a global vault-level variable and only showing a new Toast if the message is different vs. the last one? If it’s the same, just reset the timer that dismisses the toast, effectively causing it to stay onscreen if the message continues to fire.

something like this (pseudo-code)

function Notice(msg: string): void {
  if (msg == this.app.vault.lastNotice) {
    resetToastDismissTimer();
    return;
  }
  this.app.vault.lastNotice = msg;
  (...rest of the code to show the popup...)
}
1 Like