Fix performer image display (#3767)

* Fix displayed performer image sticking after save
* Reset URL before showing dialog in ImageInput
This commit is contained in:
DingDongSoLong4 2023-05-25 03:48:32 +02:00 committed by GitHub
parent 2a85d512f4
commit 3eb805ca2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -122,6 +122,11 @@ const PerformerPage: React.FC<IProps> = ({ performer }) => {
setRating
);
// reset image if performer changed
useEffect(() => {
setImage(undefined);
}, [performer]);
// set up hotkeys
useEffect(() => {
Mousetrap.bind("a", () => setActiveTabKey("details"));

View File

@ -53,6 +53,11 @@ export const ImageInput: React.FC<IImageInput> = ({
);
}
function showDialog() {
setURL("");
setIsShowDialog(true);
}
function onConfirmURL() {
if (!onImageURL) {
return;
@ -112,7 +117,7 @@ export const ImageInput: React.FC<IImageInput> = ({
</Form.Label>
</div>
<div>
<Button className="minimal" onClick={() => setIsShowDialog(true)}>
<Button className="minimal" onClick={showDialog}>
<Icon icon={faLink} className="fa-fw" />
<span>{intl.formatMessage({ id: "actions.from_url" })}</span>
</Button>