Skip to content

🎥 Make videos programmatically with React

implement bug fetching in studio

Jonny Burgerd8ed1d987fa8
diff --git a/packages/bugs/api/[v].ts b/packages/bugs/api/[v].ts
index 0d1f45a8c6..12c97cca70 100644
--- a/packages/bugs/api/[v].ts
+++ b/packages/bugs/api/[v].ts
@@ -1,3 +1,4 @@
+// Keep in sync with packages/cli/src/editor/components/UpdateCheck.tsx
type Bug = {
title: string;
description: string;
diff --git a/packages/bugs/package.json b/packages/bugs/package.json
index 97bbdc67fa..f8b4bd9c97 100644
--- a/packages/bugs/package.json
+++ b/packages/bugs/package.json
@@ -2,5 +2,6 @@
"dependencies": {
"@types/node": "^20.6.5"
},
- "private": true
+ "private": true,
+ "version": "4.0.42"
}
diff --git a/packages/cli/src/editor/components/UpdateCheck.tsx b/packages/cli/src/editor/components/UpdateCheck.tsx
index d316e7418f..8d6966e506 100644
--- a/packages/cli/src/editor/components/UpdateCheck.tsx
+++ b/packages/cli/src/editor/components/UpdateCheck.tsx
@@ -5,6 +5,7 @@ import React, {
useMemo,
useState,
} from 'react';
+import {VERSION} from 'remotion';
import type {PackageManager} from '../../preview-server/get-package-manager';
import {BLUE, FAIL_COLOR} from '../helpers/colors';
import {ModalsContext} from '../state/modals';
@@ -29,6 +30,7 @@ const buttonStyle: React.CSSProperties = {
fontSize: 14,
};
+// Keep in sync with packages/bugs/api/[v].ts
export type Bug = {
title: string;
description: string;
@@ -45,6 +47,7 @@ export const UpdateCheck = () => {
const hasKnownBugs = useMemo(() => {
return knownBugs && knownBugs.length > 0;
}, [knownBugs]);
+
const checkForUpdates = useCallback(() => {
const controller = new AbortController();
@@ -63,25 +66,35 @@ export const UpdateCheck = () => {
return controller;
}, []);
+ const checkForBugs = useCallback(() => {
+ const controller = new AbortController();
+
+ fetch(`https://bugs.remotion.dev/api/${VERSION}`, {
+ signal: controller.signal,
+ })
+ .then(async (res) => {
+ const {body} = await res.json();
+ setKnownBugs(body.bugs);
+ })
+ .catch((err: Error) => {
+ if (err.message.includes('aborted')) {
+ return;
+ }
+
+ console.log('Could not check for bugs in this version', err);
+ });
+
+ return controller;
+ }, []);
+
useEffect(() => {
- const abortController = checkForUpdates();
+ const abortUpdate = checkForUpdates();
+ const abortBugs = checkForBugs();
return () => {
- abortController.abort();
+ abortUpdate.abort();
+ abortBugs.abort();
};
- }, [checkForUpdates]);
-
- useEffect(() => {
- if (!info) {
- return;
- }
-
- fetch(
- `https://latest-stable-release.vercel.app/api/version?query=${info.currentVersion}`,
- ).then(async (res) => {
- const {body} = await res.json();
- setKnownBugs(body);
- });
- }, [info]);
+ }, [checkForBugs, checkForUpdates]);
const openModal = useCallback(() => {
setSelectedModal({
diff --git a/packages/cli/src/editor/components/UpdateModal/UpdateModal.tsx b/packages/cli/src/editor/components/UpdateModal/UpdateModal.tsx
index 6f68f23e77..832f9b2ef4 100644
--- a/packages/cli/src/editor/components/UpdateModal/UpdateModal.tsx
+++ b/packages/cli/src/editor/components/UpdateModal/UpdateModal.tsx
@@ -54,6 +54,7 @@ export const UpdateModal: React.FC<{
const hasKnownBugs = useMemo(() => {
return knownBugs && knownBugs?.length > 0;
}, [knownBugs]);
+
const command = commands[info.packageManager];
const onClick = useCallback(() => {