From 84d0cf0d14e6d8ef13509872bd6750ac244ceb71 Mon Sep 17 00:00:00 2001 From: ririxi Date: Sun, 29 Oct 2023 14:32:38 +0100 Subject: [PATCH] fix(wrapper): make the snackbar a priority (#2622) --- jsHelper/spicetifyWrapper.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/jsHelper/spicetifyWrapper.js b/jsHelper/spicetifyWrapper.js index 8d05f7f78c..f230274dd9 100644 --- a/jsHelper/spicetifyWrapper.js +++ b/jsHelper/spicetifyWrapper.js @@ -449,24 +449,25 @@ window.Spicetify = { // Combine snackbar and notification (function bindShowNotification() { if (!Spicetify.Snackbar && !Spicetify.showNotification) { - setTimeout(bindShowNotification, 10); + setTimeout(bindShowNotification, 250); return; } - if (Spicetify.Snackbar?.enqueueSnackbar && !Spicetify.showNotification) { + if (Spicetify.Snackbar?.enqueueSnackbar) { Spicetify.showNotification = (message, isError = false, msTimeout) => { Spicetify.Snackbar.enqueueSnackbar(message, { variant: isError ? "error" : "default", autoHideDuration: msTimeout }); }; - } else { - if (!Spicetify.Snackbar) Spicetify.Snackbar = {}; - Spicetify.Snackbar.enqueueSnackbar = (message, { variant = "default", autoHideDuration }) => { - isError = variant === "error"; - Spicetify.showNotification(message, isError, autoHideDuration); - }; + return; } + + if (!Spicetify.Snackbar) Spicetify.Snackbar = {}; + Spicetify.Snackbar.enqueueSnackbar = (message, { variant = "default", autoHideDuration } = {}) => { + isError = variant === "error"; + Spicetify.showNotification(message, isError, autoHideDuration); + }; })(); // Image color extractor