Fix setting scene gallery (#1484)

This commit is contained in:
WithoutPants 2021-06-06 15:33:06 +10:00 committed by GitHub
parent c53799c25b
commit 3e80dffe34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -126,6 +126,19 @@ export const SceneEditPanel: React.FC<IProps> = ({
formik.setFieldValue("rating", v);
}
interface IGallerySelectValue {
id: string;
title: string;
}
function onSetGalleries(items: IGallerySelectValue[]) {
setGalleries(items);
formik.setFieldValue(
"gallery_ids",
items.map((i) => i.id)
);
}
useEffect(() => {
if (isVisible) {
Mousetrap.bind("s s", () => {
@ -604,7 +617,7 @@ export const SceneEditPanel: React.FC<IProps> = ({
<Col xs={9}>
<GallerySelect
galleries={galleries}
onSelect={(items) => setGalleries(items)}
onSelect={(items) => onSetGalleries(items)}
/>
</Col>
</Form.Group>