mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 15:25:46 +00:00
fix(sidebar): reorder sidebar nav items by id to stop drag drift (#1206)
* fix(sidebar): reorder nav items by id instead of positional index The Settings sidebar customizer rendered library rows with one filter and reordered them with another, so a hidden/gated item (luckyMix when AudioMuse is unavailable) made the rendered list shorter than the reorder list and drag indices landed one slot off — rows jumped back on drop. Replace the index-based reorder with an id-based primitive shared by the customizer and the in-sidebar long-press DnD, so a render filter can no longer desync the move. Unknown, cross-section, conserved, or no-op drops are rejected. * docs(changelog): note sidebar reorder fix (#1206)
This commit is contained in:
@@ -147,11 +147,6 @@ export default function Sidebar({
|
||||
// React Compiler refs rule: ref kept in sync with the latest value for use in effects/handlers/cleanup; not render data.
|
||||
// eslint-disable-next-line react-hooks/refs
|
||||
sidebarItemsRef.current = sidebarItems;
|
||||
const randomNavModeRef = useRef(randomNavMode);
|
||||
// React Compiler refs rule: ref kept in sync with the latest value for use in effects/handlers/cleanup; not render data.
|
||||
// eslint-disable-next-line react-hooks/refs
|
||||
randomNavModeRef.current = randomNavMode;
|
||||
|
||||
const {
|
||||
navDnd,
|
||||
navDndTrashHint,
|
||||
@@ -161,7 +156,6 @@ export default function Sidebar({
|
||||
} = useSidebarNavDnd({
|
||||
isCollapsed,
|
||||
sidebarItemsRef,
|
||||
randomNavModeRef,
|
||||
setSidebarItems,
|
||||
});
|
||||
const newReleasesUnreadCount = useSidebarNewReleasesUnread({
|
||||
@@ -257,9 +251,7 @@ export default function Sidebar({
|
||||
musicFolders={musicFolders}
|
||||
pickLibrary={pickLibrary}
|
||||
visibleLibraryConfigs={visibleLibraryConfigs}
|
||||
libraryItemsForReorder={libraryItemsForReorder}
|
||||
visibleSystemConfigs={visibleSystemConfigs}
|
||||
systemItemsForReorder={systemItemsForReorder}
|
||||
playlistsExpanded={playlistsExpanded}
|
||||
setPlaylistsExpanded={setPlaylistsExpanded}
|
||||
playlists={playlists}
|
||||
|
||||
Reference in New Issue
Block a user