Skip to content

Commit c06fc8f

Browse files
committed
fix: apply latest fix to waitForChunks as well
It must have reverted the changes when I was rebasing latest commits from the repo locally
1 parent e157627 commit c06fc8f

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

jsHelper/spicetifyWrapper.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,13 @@ const fnStr = (f) => {
767767
return Object.values(module);
768768
} catch {}
769769
});
770-
const functionModules = modules.filter((module) => typeof module === "function");
770+
const functionModules = modules.flatMap((module) =>
771+
typeof module === "function"
772+
? [module]
773+
: typeof module === "object" && module
774+
? Object.values(module).filter((v) => typeof v === "function" && !webpackFactories.has(v))
775+
: []
776+
);
771777
const cardTypesToFind = ["artist", "audiobook", "profile", "show", "track"];
772778
// const cards = [
773779
// ...functionModules
@@ -794,21 +800,19 @@ const fnStr = (f) => {
794800
// .filter(Boolean),
795801
// ];
796802

797-
Spicetify.ReactComponent.Slider = wrapProvider(functionModules.find((m) => m.toString().includes("progressBarRef")));
798-
Spicetify.ReactComponent.Toggle = functionModules.find((m) => m.toString().includes("onSelected") && m.toString().includes('type:"checkbox"'));
799-
Spicetify.ReactComponent.ScrollableContainer = functionModules.find(
800-
(m) => m.toString().includes("scrollLeft") && m.toString().includes("showButtons")
801-
);
803+
Spicetify.ReactComponent.Slider = wrapProvider(functionModules.find((m) => fnStr(m).includes("progressBarRef")));
804+
Spicetify.ReactComponent.Toggle = functionModules.find((m) => fnStr(m).includes("onSelected") && fnStr(m).includes('type:"checkbox"'));
805+
Spicetify.ReactComponent.ScrollableContainer = functionModules.find((m) => fnStr(m).includes("scrollLeft") && fnStr(m).includes("showButtons"));
802806
// Object.assign(Spicetify.ReactComponent.Cards, Object.fromEntries(cards));
803807

804808
// chunks
805-
const dropdownChunk = chunks.find(([, value]) => value.toString().includes("dropDown") && value.toString().includes("isSafari"));
809+
const dropdownChunk = chunks.find(([, value]) => fnStr(value).includes("dropDown") && fnStr(value).includes("isSafari"));
806810
if (dropdownChunk) {
807811
Spicetify.ReactComponent.Dropdown =
808812
Object.values(require(dropdownChunk[0]))?.[0]?.render ?? Object.values(require(dropdownChunk[0])).find((m) => typeof m === "function");
809813
}
810814

811-
const toggleChunk = chunks.find(([, value]) => value.toString().includes("onSelected") && value.toString().includes('type:"checkbox"'));
815+
const toggleChunk = chunks.find(([, value]) => fnStr(value).includes("onSelected") && fnStr(value).includes('type:"checkbox"'));
812816
if (toggleChunk && !Spicetify.ReactComponent.Toggle) {
813817
Spicetify.ReactComponent.Toggle = Object.values(require(toggleChunk[0]))[0].render;
814818
}

0 commit comments

Comments
 (0)