mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-24 12:57:55 +02:00
fix(Settings): mpv path selector (#1641)
An unnecessary default value appears to be stringifying a Promise when a separate useEffect hook is supposed to properly load the setting value.
This commit is contained in:
@@ -36,9 +36,7 @@ export const MpvSettings = memo(() => {
|
|||||||
// const { pause } = usePlayerControls();
|
// const { pause } = usePlayerControls();
|
||||||
// const { clearQueue } = useQueueControls();
|
// const { clearQueue } = useQueueControls();
|
||||||
|
|
||||||
const [mpvPath, setMpvPath] = useState(
|
const [mpvPath, setMpvPath] = useState('');
|
||||||
(localSettings?.get('mpv_path') as string | undefined) || '',
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleSetMpvPath = async (clear?: boolean) => {
|
const handleSetMpvPath = async (clear?: boolean) => {
|
||||||
if (clear) {
|
if (clear) {
|
||||||
@@ -62,8 +60,8 @@ export const MpvSettings = memo(() => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const getMpvPath = async () => {
|
const getMpvPath = async () => {
|
||||||
if (!localSettings) return setMpvPath('');
|
if (!localSettings) return setMpvPath('');
|
||||||
const mpvPath = (await localSettings.get('mpv_path')) as string;
|
const mpvPath = (await localSettings.get('mpv_path')) as string | undefined;
|
||||||
return setMpvPath(mpvPath);
|
return setMpvPath(mpvPath || '');
|
||||||
};
|
};
|
||||||
|
|
||||||
getMpvPath();
|
getMpvPath();
|
||||||
|
|||||||
Reference in New Issue
Block a user