mirror of https://github.com/stashapp/stash.git
Attempted spinlock fix (#2321)
This commit is contained in:
parent
c62b0b28ed
commit
358545579a
|
@ -59,8 +59,6 @@ export const SubmitStashBoxDraft: React.FC<IProps> = ({
|
|||
const handleSelectBox = (e: React.ChangeEvent<HTMLSelectElement>) =>
|
||||
setSelectedBox(Number.parseInt(e.currentTarget.value) ?? 0);
|
||||
|
||||
console.log(data);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
icon="paper-plane"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { useCallback, useState, MouseEvent } from "react";
|
||||
import React, { useCallback, useState, useMemo, MouseEvent } from "react";
|
||||
import { useIntl } from "react-intl";
|
||||
import _ from "lodash";
|
||||
import { useHistory } from "react-router-dom";
|
||||
|
@ -78,37 +78,47 @@ const ImageListImages: React.FC<IImageListImages> = ({
|
|||
const [slideshowRunning, setSlideshowRunning] = useState<boolean>(false);
|
||||
const handleLightBoxPage = useCallback(
|
||||
(direction: number) => {
|
||||
const { currentPage } = filter;
|
||||
if (direction === -1) {
|
||||
if (currentPage === 1) {
|
||||
if (filter.currentPage === 1) {
|
||||
onChangePage(pageCount);
|
||||
} else {
|
||||
onChangePage(currentPage - 1);
|
||||
onChangePage(filter.currentPage - 1);
|
||||
}
|
||||
} else if (direction === 1) {
|
||||
if (currentPage === pageCount) {
|
||||
if (filter.currentPage === pageCount) {
|
||||
// return to the first page
|
||||
onChangePage(1);
|
||||
} else {
|
||||
onChangePage(currentPage + 1);
|
||||
onChangePage(filter.currentPage + 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
[onChangePage, filter, pageCount]
|
||||
[onChangePage, filter.currentPage, pageCount]
|
||||
);
|
||||
|
||||
const handleClose = useCallback(() => {
|
||||
setSlideshowRunning(false);
|
||||
}, [setSlideshowRunning]);
|
||||
|
||||
const showLightbox = useLightbox({
|
||||
const lightboxState = useMemo(() => {
|
||||
return {
|
||||
images,
|
||||
showNavigation: false,
|
||||
pageCallback: pageCount > 1 ? handleLightBoxPage : undefined,
|
||||
pageHeader: `Page ${filter.currentPage} / ${pageCount}`,
|
||||
slideshowEnabled: slideshowRunning,
|
||||
onClose: handleClose,
|
||||
};
|
||||
}, [
|
||||
images,
|
||||
showNavigation: false,
|
||||
pageCallback: pageCount > 1 ? handleLightBoxPage : undefined,
|
||||
pageHeader: `Page ${filter.currentPage} / ${pageCount}`,
|
||||
slideshowEnabled: slideshowRunning,
|
||||
onClose: handleClose,
|
||||
});
|
||||
pageCount,
|
||||
filter.currentPage,
|
||||
slideshowRunning,
|
||||
handleClose,
|
||||
handleLightBoxPage,
|
||||
]);
|
||||
|
||||
const showLightbox = useLightbox(lightboxState);
|
||||
|
||||
const handleImageOpen = useCallback(
|
||||
(index) => {
|
||||
|
|
Loading…
Reference in New Issue