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
2 changed files with 11 additions and 1 deletions

View File

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

View File

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