Skip to content

Commit

Permalink
Merge pull request #1104 from marekdedic/enter-handling-fix
Browse files Browse the repository at this point in the history
Fixed race conditions
  • Loading branch information
marekdedic authored Sep 25, 2024
2 parents 343e1a3 + 764a7b3 commit f55e551
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/State.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ export function State(
transitionDirection: TransitionDirection,
): void {
const newImageView = ImageView(targetImages[newIndex], options, videoCache);
currentImage = newIndex;
currentImageView = newImageView;
newImageView.startLoading(
() => {
currentImage = newIndex;
currentImageView = newImageView;
addNewImage(transitionDirection);
},
() => {
Expand Down Expand Up @@ -241,6 +241,9 @@ export function State(
}

function open(index: number, skipHistory = false): void {
if (currentImage !== null) {
return;
}
addContainerToDOM(options.animationSpeed, options.quitOnDocClick, close);
if (options.activity) {
addActivityIndicatorToDOM();
Expand Down

0 comments on commit f55e551

Please sign in to comment.