scroll restore on artists and genres pages

This commit is contained in:
2026-02-23 13:08:44 -05:00
parent 3349e785d7
commit 967816ccd2
4 changed files with 203 additions and 3 deletions
@@ -2,7 +2,7 @@ import type { ReactiveController, ReactiveControllerHost } from 'lit';
import type { library } from '@go/models';
import { libraryStore } from '../library-store';
type ViewName = 'tracks' | 'albums';
type ViewName = 'tracks' | 'albums' | 'artists' | 'genres';
/**
* LibraryController connects a Lit component to the LibraryStore.
+4 -2
View File
@@ -8,7 +8,7 @@ import {
import type { library } from '@go/models';
import { Events } from '../events';
type ViewName = 'tracks' | 'albums';
type ViewName = 'tracks' | 'albums' | 'artists' | 'genres';
type Subscriber = () => void;
@@ -38,6 +38,8 @@ class LibraryStore {
private scrollPositions: Record<ViewName, number> = {
tracks: 0,
albums: 0,
artists: 0,
genres: 0,
};
private subscribers = new Set<Subscriber>();
@@ -247,7 +249,7 @@ class LibraryStore {
this.tracks = null;
this.albums = null;
this.artists = null;
this.scrollPositions = { tracks: 0, albums: 0 };
this.scrollPositions = { tracks: 0, albums: 0, artists: 0, genres: 0 };
this.notify();
}