Bugfix/image widget starting value (#57)

* Fix image asset loading
* Fix scroll sync for frame
This commit is contained in:
Daniel Lautzenheiser
2022-11-01 14:07:30 -04:00
committed by GitHub
parent e62563e4a3
commit 6135a6c8d8
19 changed files with 354 additions and 162 deletions

View File

@ -26,8 +26,14 @@ interface ImageAssetProps {
function ImageAsset({ getAsset, value, field }: ImageAssetProps) {
const [assetSource, setAssetSource] = useState('');
useEffect(() => {
setAssetSource(getAsset(value, field)?.toString() ?? '');
}, [field, getAsset, value]);
const getImage = async() => {
const asset = (await getAsset(value, field))?.toString() ?? '';
setAssetSource(asset);
};
getImage();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [value]);
return <StyledImage src={assetSource} />;
}