diff options
author | crupest <crupest@outlook.com> | 2020-08-10 16:56:09 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-08-10 16:56:09 +0800 |
commit | 9bd53ad844b66f14080f3a142a419fed1d8bd491 (patch) | |
tree | d2b0380902f2cf4f7ab58f6cd4cec931ffd24dc0 /Timeline/ClientApp/src/app/common/BlobImage.tsx | |
parent | e1b260e3e04341703944a9c1167c2546ff514fb9 (diff) | |
download | timeline-9bd53ad844b66f14080f3a142a419fed1d8bd491.tar.gz timeline-9bd53ad844b66f14080f3a142a419fed1d8bd491.tar.bz2 timeline-9bd53ad844b66f14080f3a142a419fed1d8bd491.zip |
Do not block when get post data.
Diffstat (limited to 'Timeline/ClientApp/src/app/common/BlobImage.tsx')
-rw-r--r-- | Timeline/ClientApp/src/app/common/BlobImage.tsx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Timeline/ClientApp/src/app/common/BlobImage.tsx b/Timeline/ClientApp/src/app/common/BlobImage.tsx index 91497705..7e5e2447 100644 --- a/Timeline/ClientApp/src/app/common/BlobImage.tsx +++ b/Timeline/ClientApp/src/app/common/BlobImage.tsx @@ -3,14 +3,16 @@ import React from 'react'; import { ExcludeKey } from '../utilities/type';
const BlobImage: React.FC<
- ExcludeKey<React.ImgHTMLAttributes<HTMLImageElement>, 'src'> & { blob?: Blob }
+ ExcludeKey<React.ImgHTMLAttributes<HTMLImageElement>, 'src'> & {
+ blob?: Blob | unknown;
+ }
> = (props) => {
const { blob, ...otherProps } = props;
const [url, setUrl] = React.useState<string | undefined>(undefined);
React.useEffect(() => {
- if (blob != null) {
+ if (blob instanceof Blob) {
const url = URL.createObjectURL(blob);
setUrl(url);
return () => {
|