diff --git a/package.json b/package.json index 6f8af99..cf5b66d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "wow-best-places", "description": "This app is supposed to make you feel nostalgic", - "version": "1.2.0", + "version": "1.3.0", "author": { "name": "obergodmar", "email": "obergodmar@gmail.com", diff --git a/src/app/index.tsx b/src/app/index.tsx index e7be3cb..df29eda 100644 --- a/src/app/index.tsx +++ b/src/app/index.tsx @@ -69,9 +69,13 @@ export default function App() { }) }, [isLoading]) - const handleLeftPreviewClick = (value: number) => delayedChange(setActivePlace, value) + const handleLeftPreviewClick = useCallback((value: number) => + delayedChange(setActivePlace, value), + [delayedChange]) - const handleBottomPreviewClick = (value: number) => delayedChange(setActiveView, value) + const handleBottomPreviewClick = useCallback((value: number) => + delayedChange(setActiveView, value), + [delayedChange]) useEffect(() => { if (app && app.current) { @@ -89,11 +93,12 @@ export default function App() { return } currentPlaying.setVolume(musicVolume) + currentPlaying.playMusic() }, [currentPlaying, musicVolume]) - const appClick = () => currentPlaying && currentPlaying.playMusic() + const appClick = useCallback(() => currentPlaying && currentPlaying.playMusic(), [currentPlaying]) - const openCloseSettings = () => { + const openCloseSettings = useCallback(() => { setSettingsShown(!isSettingsShown) if (app && app.current) { app.current.focus() @@ -106,9 +111,9 @@ export default function App() { } else { settingsOpenSound.playSound() } - } + }, [app, isSettingsShown, uiSound, settingsCloseSound, settingsOpenSound]) - const handleOpenSettings = (e: KeyboardEvent) => { + const handleOpenSettings = useCallback((e: KeyboardEvent) => { switch (e.keyCode) { case 27: if (isLeftPanelShown || isBottomPanelShown) { @@ -129,7 +134,7 @@ export default function App() { currentPlaying.playMusic() } } - } + }, [isLeftPanelShown, isBottomPanelShown, isPlaying, currentPlaying, openCloseSettings]) return (