🎥 Make videos programmatically with React
effectindex was not actually meaningful
JonnyBurgerf393e2bf1bea
diff --git a/packages/studio-server/src/preview-server/routes/can-update-effect-props.ts b/packages/studio-server/src/preview-server/routes/can-update-effect-props.tsindex 89998eec26..e2031793b7 100644--- a/packages/studio-server/src/preview-server/routes/can-update-effect-props.ts+++ b/packages/studio-server/src/preview-server/routes/can-update-effect-props.ts@@ -99,11 +99,11 @@ const getPropsFromObjectExpression = ({export const computeEffectPropStatus = ({jsx,- subscription,+ effectIndex,keys,}: {jsx: JSXOpeningElement;- subscription: {effectIndex: number};+ effectIndex: number;keys: string[];}): CanUpdateEffectPropsResponse => {const attr = findExperimentalEffectsAttr(jsx);@@ -112,27 +112,24 @@ export const computeEffectPropStatus = ({if (!elements) {return {canUpdate: false,- effectIndex: subscription.effectIndex,+ effectIndex,reason: 'not-found',};}- if (- subscription.effectIndex < 0 ||- subscription.effectIndex >= elements.length- ) {+ if (effectIndex < 0 || effectIndex >= elements.length) {return {canUpdate: false,- effectIndex: subscription.effectIndex,+ effectIndex,reason: 'not-found',};}- const target = elements[subscription.effectIndex];+ const target = elements[effectIndex];if (target.kind !== 'call') {return {canUpdate: false,- effectIndex: subscription.effectIndex,+ effectIndex,reason: 'not-call-expression',};}@@ -146,7 +143,7 @@ export const computeEffectPropStatus = ({return {canUpdate: true,- effectIndex: subscription.effectIndex,+ effectIndex,props: emptyProps,};}@@ -155,7 +152,7 @@ export const computeEffectPropStatus = ({if (firstArg.type !== 'ObjectExpression') {return {canUpdate: false,- effectIndex: subscription.effectIndex,+ effectIndex,reason: 'no-args-object',};}@@ -167,7 +164,7 @@ export const computeEffectPropStatus = ({return {canUpdate: true,- effectIndex: subscription.effectIndex,+ effectIndex,props: resolvedProps,};};@@ -186,17 +183,17 @@ export const computeEffectPropsStatusesFromContent = ({const ast = parseAst(fileContents);const jsx = findJsxElementAtNodePath(ast, sequenceNodePath);if (!jsx) {- return effects.map((effect) => ({+ return effects.map((_effect, effectIndex) => ({canUpdate: false as const,- effectIndex: effect.effectIndex,+ effectIndex,reason: 'not-found' as const,}));}- return effects.map((effect) =>+ return effects.map((effect, effectIndex) =>computeEffectPropStatus({jsx,- subscription: effect,+ effectIndex,keys: keysFor(effect),}),);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 c5b7e33df3..6c678f577d 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@@ -312,10 +312,10 @@ const computeEffectsForJsx = ({jsxElement: JSXOpeningElement;effects: EffectSubscription[];}) => {- return effects.map((effect) =>+ return effects.map((effect, effectIndex) =>computeEffectPropStatus({jsx: jsxElement,- subscription: effect,+ effectIndex,keys: getAllSchemaKeys(effect.schema),}),);diff --git a/packages/studio-server/src/preview-server/routes/save-effect-props.ts b/packages/studio-server/src/preview-server/routes/save-effect-props.tsindex a2a002e189..4aa4d2010a 100644--- a/packages/studio-server/src/preview-server/routes/save-effect-props.ts+++ b/packages/studio-server/src/preview-server/routes/save-effect-props.ts@@ -131,7 +131,7 @@ export const saveEffectPropsHandler: ApiHandler<return computeEffectPropStatus({jsx,- subscription: {effectIndex},+ effectIndex,keys: getAllSchemaKeys(schema),});};diff --git a/packages/studio-server/src/test/compute-effect-props-status.test.ts b/packages/studio-server/src/test/compute-effect-props-status.test.tsindex 9f1b4eab4d..be395671f3 100644--- a/packages/studio-server/src/test/compute-effect-props-status.test.ts+++ b/packages/studio-server/src/test/compute-effect-props-status.test.ts@@ -32,7 +32,7 @@ test('computeEffectPropStatus reports static props as canUpdate=true with codeVaconst input = buildInput('[tint({color: "red", opacity: 0.5})]');const result = computeEffectPropStatus({jsx: findJsx(input),- subscription: {effectIndex: 0},+ effectIndex: 0,keys: ['color', 'opacity'],});@@ -49,7 +49,7 @@ test('computeEffectPropStatus reports computed props', () => {const input = buildInput('[tint({color: getColor(), opacity: 0.5})]');const result = computeEffectPropStatus({jsx: findJsx(input),- subscription: {effectIndex: 0},+ effectIndex: 0,keys: ['color', 'opacity'],});@@ -66,7 +66,7 @@ test('computeEffectPropStatus reports unset props as undefined codeValue', () =>const input = buildInput('[tint({color: "red"})]');const result = computeEffectPropStatus({jsx: findJsx(input),- subscription: {effectIndex: 0},+ effectIndex: 0,keys: ['color', 'opacity'],});@@ -83,7 +83,7 @@ test('computeEffectPropStatus flags non-call expressions', () => {const input = buildInput('[someEffect, tint({color: "red"})]');const result = computeEffectPropStatus({jsx: findJsx(input),- subscription: {effectIndex: 0},+ effectIndex: 0,keys: ['color'],});@@ -99,7 +99,7 @@ test('computeEffectPropStatus flags out-of-range effect indices', () => {const input = buildInput('[tint({color: "red"})]');const result = computeEffectPropStatus({jsx: findJsx(input),- subscription: {effectIndex: 5},+ effectIndex: 5,keys: ['color'],});@@ -115,7 +115,7 @@ test('computeEffectPropStatus flags non-object first arg', () => {const input = buildInput('[tint(getParams())]');const result = computeEffectPropStatus({jsx: findJsx(input),- subscription: {effectIndex: 0},+ effectIndex: 0,keys: ['color'],});diff --git a/packages/studio-shared/src/api-requests.ts b/packages/studio-shared/src/api-requests.tsindex 60880c5e0b..fdfa70c8de 100644--- a/packages/studio-shared/src/api-requests.ts+++ b/packages/studio-shared/src/api-requests.ts@@ -216,7 +216,6 @@ export type CanUpdateSequencePropsRequest = {};export type EffectSubscription = {- effectIndex: number;schema: SequenceSchema;};diff --git a/packages/studio/src/components/Timeline/SubscribeToNodePaths.tsx b/packages/studio/src/components/Timeline/SubscribeToNodePaths.tsxindex c7435f07ab..def046502b 100644--- a/packages/studio/src/components/Timeline/SubscribeToNodePaths.tsx+++ b/packages/studio/src/components/Timeline/SubscribeToNodePaths.tsx@@ -15,14 +15,13 @@ export const SubscribeToNodePaths: FC<{const effectSubscriptions = useMemo<EffectSubscription[]>(() => {return effects- .map((effect, index): EffectSubscription | null => {+ .map((effect): EffectSubscription | null => {if (!effect.schema) {return null;}return {schema: effect.schema,- effectIndex: index,};}).filter(NoReactInternals.truthy);diff --git a/packages/studio/src/components/Timeline/sequence-props-subscription-store.ts b/packages/studio/src/components/Timeline/sequence-props-subscription-store.tsindex 9e965d8157..1a0f74be02 100644--- a/packages/studio/src/components/Timeline/sequence-props-subscription-store.ts+++ b/packages/studio/src/components/Timeline/sequence-props-subscription-store.ts@@ -46,6 +46,7 @@ export const acquireSequencePropsSubscription = ({applyOnce: ApplyResult;applyEach: ApplyResult;}): {release: () => void} => {+ // TODO: Bug - schema keys and effects are not part of the cache keyconst key = makeKey(fileName, line, column);let entry = entries.get(key);