@@ -11,13 +11,13 @@ export function useSelection(photosStore: PhotosStore, albumsStore: AlbumsStore,
1111
1212 const { selectedPhotosIdx, selectedAlbumsIdx } = storeToRefs ( togglableStore ) ;
1313 const selectedPhoto = computed < App . Http . Resources . Models . PhotoResource | undefined > ( ( ) =>
14- selectedPhotosIdx . value . length === 1 ? ( photosStore . photos [ selectedPhotosIdx . value [ 0 ] ] ?? undefined ) : undefined ,
14+ selectedPhotosIdx . value . length === 1 ? ( photosStore . filteredPhotos [ selectedPhotosIdx . value [ 0 ] ] ?? undefined ) : undefined ,
1515 ) ;
1616 const selectedAlbum = computed < App . Http . Resources . Models . ThumbAlbumResource | undefined > ( ( ) =>
1717 selectedAlbumsIdx . value . length === 1 ? ( albumsStore . selectableAlbums [ selectedAlbumsIdx . value [ 0 ] ] ?? undefined ) : undefined ,
1818 ) ;
1919 const selectedPhotos = computed < App . Http . Resources . Models . PhotoResource [ ] > (
20- ( ) => photosStore . photos . filter ( ( _ , idx ) => selectedPhotosIdx . value . includes ( idx ) ) ?? [ ] ,
20+ ( ) => photosStore . filteredPhotos . filter ( ( _ , idx ) => selectedPhotosIdx . value . includes ( idx ) ) ?? [ ] ,
2121 ) ;
2222 const selectedAlbums = computed < App . Http . Resources . Models . ThumbAlbumResource [ ] > (
2323 ( ) => albumsStore . selectableAlbums ?. filter ( ( _ , idx ) => selectedAlbumsIdx . value . includes ( idx ) ) ?? [ ] ,
@@ -80,7 +80,7 @@ export function useSelection(photosStore: PhotosStore, albumsStore: AlbumsStore,
8080 e . preventDefault ( ) ;
8181 e . stopPropagation ( ) ;
8282
83- if ( photosStore . photos . length === 0 || canInteractPhoto ( ) === false ) {
83+ if ( photosStore . filteredPhotos . length === 0 || canInteractPhoto ( ) === false ) {
8484 return ;
8585 }
8686
@@ -205,24 +205,24 @@ export function useSelection(photosStore: PhotosStore, albumsStore: AlbumsStore,
205205 }
206206
207207 function selectEverything ( ) : void {
208- if ( selectedPhotosIdx . value . length === photosStore . photos . length && albumsStore . selectableAlbums . length > 0 ) {
208+ if ( selectedPhotosIdx . value . length === photosStore . filteredPhotos . length && albumsStore . selectableAlbums . length > 0 ) {
209209 // Flip and select albums
210210 selectedPhotosIdx . value = [ ] ;
211211 selectedAlbumsIdx . value = getKeysFromPredicate ( albumsStore . selectableAlbums , canInteractAlbum ) ;
212212 return ;
213213 }
214- if ( selectedAlbumsIdx . value . length === albumsStore . selectableAlbums . length && photosStore . photos . length > 0 ) {
214+ if ( selectedAlbumsIdx . value . length === albumsStore . selectableAlbums . length && photosStore . filteredPhotos . length > 0 ) {
215215 selectedAlbumsIdx . value = [ ] ;
216- selectedPhotosIdx . value = getKeysFromPredicate ( photosStore . photos , canInteractPhoto ) ;
216+ selectedPhotosIdx . value = getKeysFromPredicate ( photosStore . filteredPhotos , canInteractPhoto ) ;
217217 // Flip and select photos
218218 return ;
219219 }
220220 if ( selectedAlbumsIdx . value . length > 0 && albumsStore . selectableAlbums . length > 0 ) {
221221 selectedAlbumsIdx . value = getKeysFromPredicate ( albumsStore . selectableAlbums , canInteractAlbum ) ;
222222 return ;
223223 }
224- if ( photosStore . photos . length > 0 ) {
225- selectedPhotosIdx . value = getKeysFromPredicate ( photosStore . photos , canInteractPhoto ) ;
224+ if ( photosStore . filteredPhotos . length > 0 ) {
225+ selectedPhotosIdx . value = getKeysFromPredicate ( photosStore . filteredPhotos , canInteractPhoto ) ;
226226 return ;
227227 }
228228 if ( albumsStore . selectableAlbums . length > 0 ) {
0 commit comments