spicetify / cli

Command-line tool to customize Spotify client. Supports Windows, MacOS, and Linux.
https://spicetify.app
GNU Lesser General Public License v2.1
18.17k stars 716 forks source link

confirm dialogue not working as it did in previous versions #3091

Closed ohitstom closed 2 months ago

ohitstom commented 2 months ago

🔍 Have you checked Spicetify.app page for your issue?

🔍 Is there already an issue for your problem?

ℹ Environment / Computer Info

Spotify for Windows (64 bit)
1.2.41.434.g39a25e2c
Spicetify v2.36.14
Theme: Comfy / Comfy
Extensions: npvAmbience.js, toggleDJ.js, gamepad.js, spotifyBackup.js, playbarClock.js, quickQueue.js, scannables.js, sleepTimer.js, tracksToEdges.js, adblock.js, immersiveView.js, volumePercentage.js
Custom apps: lyrics-plus, new-releases, marketplace
xpui_2024-06-28_1719586782170_39a25e2
cef_125.0.19+g3d8f1c9+chromium-125.0.6422.112
Runtime: Chrome
Build System: CMake

📝 Description

Is it no longer a function and now a symbol? if so how can i make my old code work with it - or is this not intended

const Dialog = Spicetify.React.memo(props => {
const [state, setState] = Spicetify.React.useState(true);
const self = document.querySelector(".ReactModalPortal:last-of-type");

Spicetify.React.useEffect(() => {
    if (state) {
        props.onOpen?.();
    }
}, [state]);

return Spicetify.ReactComponent.ConfirmDialog({
    ...props,
    isOpen: state,
    onClose: () => {
        setState(false);
        props.onClose();
        self.remove();
    },
    onConfirm: () => {
        setState(false);
        props.onConfirm();
        self.remove();
    }
});
});

📸 Screenshots

image

rxri commented 2 months ago

ConfirmDialog is a JSX component. Blame Spotify for making it different

ohitstom commented 2 months ago

ConfirmDialog is a JSX component. Blame Spotify's for making it different

does this mean i can just do Spicetify.ReactComponent.ConfirmDialog.render({}) in its place?

ah just gotta wrap it in a new createElement, thanks for the help :)

rxri commented 2 months ago

Use React to create the element with this component

Delusoire commented 2 months ago

Even when ConfirmDialog was a functional component, you should have used createElement... Stop making bs issues and cluttering everyone's inboxes.

ohitstom commented 2 months ago

Even when ConfirmDialog was a functional component, you should have used createElement... Stop making bs issues and cluttering everyone's inboxes.

get a life mate, the docs dont say as much and there are plenty of more pointless issues "cluttering everyones inboxes".