🎥 Make videos programmatically with React
only send node path conditionally
Jonny Burger61a32d110f1f
diff --git a/packages/studio-server/src/preview-server/jsx-element-not-found-at-location-error.ts b/packages/studio-server/src/preview-server/jsx-element-not-found-at-location-error.tsnew file mode 100644index 0000000000..09b9e2e895--- /dev/null+++ b/packages/studio-server/src/preview-server/jsx-element-not-found-at-location-error.ts@@ -0,0 +1,8 @@+export class JsxElementNotFoundAtLocationError extends Error {+ constructor() {+ super(+ 'Cannot compute sequence props status: Could not find a JSX element at the specified location',+ );+ this.name = 'JsxElementNotFoundAtLocationError';+ }+}diff --git a/packages/studio-server/src/preview-server/routes/can-update-sequence-props.ts b/packages/studio-server/src/preview-server/routes/can-update-sequence-props.tsindex 786b47085c..7db72cfd94 100644--- a/packages/studio-server/src/preview-server/routes/can-update-sequence-props.ts+++ b/packages/studio-server/src/preview-server/routes/can-update-sequence-props.ts@@ -18,6 +18,7 @@ import type {SequenceNodePath} from 'remotion';import type {CanUpdateSequencePropStatus} from 'remotion';import {parseAst} from '../../codemods/parse-ast';import {getAstNodePath} from '../../helpers/get-ast-node-path';+import {JsxElementNotFoundAtLocationError} from '../jsx-element-not-found-at-location-error';import {computeEffectPropStatus} from './can-update-effect-props';type CanUpdatePropStatus = CanUpdateSequencePropStatus;@@ -393,9 +394,7 @@ export const computeSequencePropsStatusFromContent = ({const jsxElement = findJsxElementAtNodePath(ast, nodePath);if (!jsxElement) {- throw new Error(- 'Cannot compute sequence props status: Could not find a JSX element at the specified location',- );+ throw new JsxElementNotFoundAtLocationError();}const filteredProps = computeSequenceOnlyPropsRecord({jsxElement, keys});diff --git a/packages/studio-server/src/preview-server/sequence-props-watchers.ts b/packages/studio-server/src/preview-server/sequence-props-watchers.tsindex f8bd35f345..e8c82592ad 100644--- a/packages/studio-server/src/preview-server/sequence-props-watchers.ts+++ b/packages/studio-server/src/preview-server/sequence-props-watchers.ts@@ -7,6 +7,7 @@ import {} from '@remotion/studio-shared';import type {SequenceNodePath} from 'remotion';import {installFileWatcher} from '../file-watcher';+import {JsxElementNotFoundAtLocationError} from './jsx-element-not-found-at-location-error';import {waitForLiveEventsListener} from './live-events';import {getCachedNodePath, setCachedNodePath} from './node-path-cache';import {@@ -164,15 +165,18 @@ export const subscribeToSequencePropsWatchers = ({});});} catch (error) {- // TODO: Check error if we are supposed to be here- waitForLiveEventsListener().then((listener) => {- listener.sendEventToClientId(clientId, {- type: 'lost-node-path',- fileName,- line,- column,+ if (error instanceof JsxElementNotFoundAtLocationError) {+ waitForLiveEventsListener().then((listener) => {+ listener.sendEventToClientId(clientId, {+ type: 'lost-node-path',+ fileName,+ line,+ column,+ });});- });+ return;+ }+RenderInternals.Log.error({indent: false, logLevel}, error);}},