diff options
Diffstat (limited to 'src/view/com/composer/useExternalLinkFetch.ts')
-rw-r--r-- | src/view/com/composer/useExternalLinkFetch.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/view/com/composer/useExternalLinkFetch.ts b/src/view/com/composer/useExternalLinkFetch.ts index 317514437..1a36b5034 100644 --- a/src/view/com/composer/useExternalLinkFetch.ts +++ b/src/view/com/composer/useExternalLinkFetch.ts @@ -3,6 +3,7 @@ import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {logger} from '#/logger' +import {createComposerImage} from '#/state/gallery' import {useFetchDid} from '#/state/queries/handle' import {useGetPost} from '#/state/queries/post' import {useAgent} from '#/state/session' @@ -26,7 +27,6 @@ import { isBskyStartUrl, isShortLink, } from 'lib/strings/url-helpers' -import {ImageModel} from 'state/models/media/image' import {ComposerOpts} from 'state/shell/composer' export function useExternalLinkFetch({ @@ -161,14 +161,15 @@ export function useExternalLinkFetch({ timeout: 15e3, }) .catch(() => undefined) - .then(localThumb => { + .then(thumb => (thumb ? createComposerImage(thumb) : undefined)) + .then(thumb => { if (aborted) { return } setExtLink({ ...extLink, isLoading: false, // done - localThumb: localThumb ? new ImageModel(localThumb) : undefined, + localThumb: thumb, }) }) return cleanup |