mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +00:00
perf(floating-bar): subscribe themeStore via selector
Both AppShell and PlayerBar read floatingPlayerBar via destructured useThemeStore() without a selector, so every unrelated theme change (accent, font, scheduler state, …) would force a re-render. Switch to s => s.floatingPlayerBar so these components only re-render when the toggle actually flips. Follow-up to PR #216. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -145,7 +145,7 @@ function AppShell() {
|
|||||||
const setEntityRatingSupport = useAuthStore(s => s.setEntityRatingSupport);
|
const setEntityRatingSupport = useAuthStore(s => s.setEntityRatingSupport);
|
||||||
const offlineAlbums = useOfflineStore(s => s.albums);
|
const offlineAlbums = useOfflineStore(s => s.albums);
|
||||||
const hasOfflineContent = Object.values(offlineAlbums).some(a => a.serverId === serverId);
|
const hasOfflineContent = Object.values(offlineAlbums).some(a => a.serverId === serverId);
|
||||||
const { floatingPlayerBar } = useThemeStore();
|
const floatingPlayerBar = useThemeStore(s => s.floatingPlayerBar);
|
||||||
|
|
||||||
// Mini player → main: route requests dispatched as `psy:navigate`
|
// Mini player → main: route requests dispatched as `psy:navigate`
|
||||||
// CustomEvents from the bridge land here so React Router can take over.
|
// CustomEvents from the bridge land here so React Router can take over.
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ export default function PlayerBar() {
|
|||||||
setUserRatingOverride: s.setUserRatingOverride,
|
setUserRatingOverride: s.setUserRatingOverride,
|
||||||
})));
|
})));
|
||||||
const { lastfmSessionKey } = useAuthStore();
|
const { lastfmSessionKey } = useAuthStore();
|
||||||
const { floatingPlayerBar } = useThemeStore();
|
const floatingPlayerBar = useThemeStore(s => s.floatingPlayerBar);
|
||||||
const [floatingStyle, setFloatingStyle] = useState<React.CSSProperties>({});
|
const [floatingStyle, setFloatingStyle] = useState<React.CSSProperties>({});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user