fix: refresh libraries on drawer open and stop playlist page render loop
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped
- Zustand selector returned a new array on every render in PlaylistTitlePage, causing getSnapshot/useSyncExternalStore infinite updates. - Cache playlist tracks per playlist id. - Refetch server views each time the drawer opens so newly added libraries (e.g. Music) appear without restarting the app.
This commit is contained in:
1 parent
b00f93d262
commit
cc1391bb7d
2 files changed
+13
-6
No files matched your search
@@ -70,7 +70,7 @@ function PlaylistTitlePage() {
|
||||
});
|
||||
|
||||
const musicTracks = useQuery({
|
||||
queryKey: ["item", "musicTracks"],
|
||||
queryKey: ["item", id, "musicTracks"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
if (!item.data?.Id) return null;
|
||||
@@ -84,13 +84,13 @@ function PlaylistTitlePage() {
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
||||
const setAppBackdrop = useBackdropStore((state) => state.setBackdrop);
|
||||
|
||||
useEffect(() => {
|
||||
if (item.isSuccess) {
|
||||
setAppBackdrop("", "");
|
||||
setAppBackdrop(undefined);
|
||||
}
|
||||
}, []);
|
||||
}, [item.isSuccess, setAppBackdrop]);
|
||||
|
||||
if (item.isPending || similarItems.isPending) {
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user