diff --git a/app/javascript/mastodon/features/ui/components/focal_point_modal.js b/app/javascript/mastodon/features/ui/components/focal_point_modal.js index d5a74d1ce..c934e1674 100644 --- a/app/javascript/mastodon/features/ui/components/focal_point_modal.js +++ b/app/javascript/mastodon/features/ui/components/focal_point_modal.js @@ -224,15 +224,16 @@ class FocalPointModal extends ImmutablePureComponent { } } - (async () => { - await worker.loadLanguage('eng+chi_sim+chi_sim_vert+chi_tra+chi_tra_vert'); - await worker.initialize('eng+chi_sim+chi_tra'); - worker.recognize(media_url) - .progress(({ progress }) => this.setState({ progress })) - .finally(() => worker.terminate()) - .then(({ text }) => this.setState({ description: removeExtraLineBreaks(text), dirty: true, detecting: false })) - .catch(() => this.setState({ detecting: false })); - })(); + worker.loadLanguage('eng+chi_sim+chi_sim_vert+chi_tra+chi_tra_vert') + .then(() => worker.initialize('eng+chi_sim+chi_tra') + .then(() => { + worker.recognize(media_url) + .progress(({ progress }) => this.setState({ progress })) + .finally(() => worker.terminate()) + .then(({ text }) => this.setState({ description: removeExtraLineBreaks(text), dirty: true, detecting: false })) + .catch(() => this.setState({ detecting: false })); + }) + ); }).catch(() => this.setState({ detecting: false })); }