Skip to content

🎥 Make videos programmatically with React

fix updatecheck message

Jonny Burgerb12f506610e2
diff --git a/packages/cli/src/editor/components/UpdateCheck.tsx b/packages/cli/src/editor/components/UpdateCheck.tsx
index da4962bb3e..9da132dc0a 100644
--- a/packages/cli/src/editor/components/UpdateCheck.tsx
+++ b/packages/cli/src/editor/components/UpdateCheck.tsx
@@ -28,16 +28,31 @@ export const UpdateCheck = () => {
const {tabIndex} = useZIndex();
const checkForUpdates = useCallback(() => {
- fetch('/api/update')
+ const controller = new AbortController();
+
+ fetch('/api/update', {
+ signal: controller.signal,
+ })
.then((res) => res.json())
- .then((d) => setInfo(d))
- .catch((err) => {
+ .then((d) => {
+ setInfo(d);
+ })
+ .catch((err: Error) => {
+ if (err.message.includes('aborted')) {
+ return;
+ }
+
console.log('Could not check for updates', err);
});
+
+ return controller;
}, []);
useEffect(() => {
- checkForUpdates();
+ const abortController = checkForUpdates();
+ return () => {
+ abortController.abort();
+ };
}, [checkForUpdates]);
const openModal = useCallback(() => {