{"record":{"id":"f02dd38c485c3b6d","repo":"remotion-dev/remotion","slug":"usetimelinerowcontainsselection-must-be-used-inside","errorCode":null,"errorMessage":"useTimelineRowContainsSelection must be used inside TimelineSelectionProvider","messagePattern":"useTimelineRowContainsSelection must be used inside TimelineSelectionProvider","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/studio/src/components/Timeline/TimelineSelection.tsx","lineNumber":1785,"sourceCode":"\t\t(): TimelineSelection => ({\n\t\t\ttype: 'guide',\n\t\t\tguideId,\n\t\t}),\n\t\t[guideId],\n\t);\n\treturn useTimelineSelectionItem({\n\t\trevealInInspector: false,\n\t\tselectionItem,\n\t\tuseSelectionOrder: false,\n\t});\n};\n\nexport const useTimelineRowContainsSelection = (\n\tnodePathInfo: SequenceNodePathInfo | null,\n): boolean => {\n\tconst selectionContext = useContext(TimelineRowSelectionContext);\n\tif (selectionContext === null) {\n\t\tthrow new Error(\n\t\t\t'useTimelineRowContainsSelection must be used inside TimelineSelectionProvider',\n\t\t);\n\t}\n\n\tconst getContainsSelection = useCallback(() => {\n\t\tif (nodePathInfo === null) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn selectionContext\n\t\t\t.getSnapshot()\n\t\t\t.selectedItems.some(\n\t\t\t\t(selected) =>\n\t\t\t\t\tselected.type !== 'guide' &&\n\t\t\t\t\tnodePathDescendsFrom(selected.nodePathInfo, nodePathInfo),\n\t\t\t);\n\t}, [nodePathInfo, selectionContext]);\n","sourceCodeStart":1767,"sourceCodeEnd":1803,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/studio/src/components/Timeline/TimelineSelection.tsx#L1767-L1803","documentation":"useTimelineRowContainsSelection reports whether a Timeline row contains the current selection. It requires TimelineRowSelectionContext and throws this error when invoked outside TimelineSelectionProvider.","triggerScenarios":"Calling useTimelineRowContainsSelection in a custom row or layout component rendered outside the Timeline selection provider subtree, or after refactoring removed/reordered the provider.","commonSituations":"Customizing Studio's Timeline layout; reusing a row component in another panel; provider order changed while merging upstream Studio changes.","solutions":["Render the consuming component inside <TimelineSelectionProvider>.","Inspect the React tree to confirm the provider is an ancestor of the hook caller.","Move the hook call into the part of the tree that sits under the provider, or lift state usage differently.","Diff your Timeline customizations against upstream to restore provider nesting."],"exampleFix":"// before\nexport const MyRow = () => { useTimelineRowContainsSelection(p); ... };\n// after — render MyRow inside the provider\n<TimelineSelectionProvider><MyRow /></TimelineSelectionProvider>","handlingStrategy":"validation","validationCode":"// only call in components mounted under TimelineSelectionProvider\nconst contains = useTimelineRowContainsSelection(path); // must be within provider","typeGuard":null,"tryCatchPattern":"try {\n  computeContains();\n} catch (e) {\n  if (e.message.includes('useTimelineRowContainsSelection must be used inside')) {\n    return false; // safe default outside provider\n  }\n  throw e;\n}","preventionTips":["Verify provider nesting after merging upstream Studio refactors.","Don't reuse row components outside the Timeline provider subtree.","Add a smoke test that renders custom rows inside the provider."],"tags":["react","context","hooks","studio"],"backgroundTag":"missing-required-argument","analyzedSha":"46a3a6bf13ca367376ff18bbb06dae2e87e0d068","analyzedAt":"2026-09-18T00:12:20.256Z","contentChangedAt":"2026-09-18T00:12:20.256Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}