1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-02-01 13:17:55 +02:00

improve race condition for opening lightbox

This commit is contained in:
Patrik J. Braun 2023-09-20 22:03:25 +02:00
parent 1bf1306237
commit f4cdb5a83a
3 changed files with 250 additions and 245 deletions

View File

@ -2,7 +2,7 @@ import {Injectable} from '@angular/core';
import {BehaviorSubject, Observable} from 'rxjs';
import {PhotoDTO} from '../../../../../common/entities/PhotoDTO';
import {DirectoryContent} from '../contentLoader.service';
import {map, switchMap} from 'rxjs/operators';
import {debounceTime, map, switchMap} from 'rxjs/operators';
export enum FilterRenderType {
enum = 1,
@ -224,6 +224,7 @@ export class FilterService {
directoryContent: Observable<DirectoryContent>
): Observable<DirectoryContent> {
return directoryContent.pipe(
debounceTime(1),
switchMap((dirContent: DirectoryContent) => {
this.statistic = this.getStatistic(dirContent);
this.resetFilters(false);

View File

@ -385,6 +385,9 @@ export class GalleryGridComponent
* Makes sure that the photo with the given mediaString is visible on the screen
*/
private renderUpToMedia(mediaStringId: string): void {
if (!this.mediaGroups) {
return;
}
let groupIndex = -1;
let mediaIndex = -1;
for (let i = 0; i < this.mediaGroups.length; ++i) {

View File

@ -105,11 +105,12 @@ export class GalleryLightboxComponent implements OnDestroy, OnInit {
this.updatePhotoFrameDim();
this.subscription.route = this.route.queryParams.subscribe(
(params: Params) => {
this.delayedMediaShow = null;
if (
params[QueryParams.gallery.photo] &&
params[QueryParams.gallery.photo] !== ''
) {
this.delayedMediaShow = params[QueryParams.gallery.photo]
this.delayedMediaShow = params[QueryParams.gallery.photo];
// photos are not yet available to show
if (!this.gridPhotoQL) {
return;