@@ -20,7 +20,6 @@ interface NLEPreviewProps {
2020 onCompositionLoadingChange ?: ( loading : boolean ) => void ;
2121 portrait ?: boolean ;
2222 directUrl ?: string ;
23- refreshKey ?: number ;
2423 suppressLoadingOverlay ?: boolean ;
2524}
2625
@@ -30,7 +29,6 @@ export function getPreviewPlayerKey({
3029} : {
3130 projectId : string ;
3231 directUrl ?: string ;
33- refreshKey ?: number ;
3432} ) : string {
3533 return directUrl ?? projectId ;
3634}
@@ -91,16 +89,12 @@ export const NLEPreview = memo(function NLEPreview({
9189 onCompositionLoadingChange,
9290 portrait,
9391 directUrl,
94- refreshKey,
9592 suppressLoadingOverlay,
9693} : NLEPreviewProps ) {
97- const baseKey = getPreviewPlayerKey ( { projectId, directUrl, refreshKey } ) ;
98- const prevRefreshKeyRef = useRef ( refreshKey ) ;
94+ const activeKey = getPreviewPlayerKey ( { projectId, directUrl } ) ;
9995 const viewportRef = useRef < HTMLDivElement > ( null ) ;
10096 const stageRef = useRef < HTMLDivElement > ( null ) ;
101- const [ retiringKey , setRetiringKey ] = useState < string | null > ( null ) ;
10297 const [ stageSize , setStageSize ] = useState ( ( ) => resolvePreviewStageSize ( 0 , 0 , portrait ) ) ;
103- const retiringTimerRef = useRef < ReturnType < typeof setTimeout > | null > ( null ) ;
10498
10599 const zoomRef = useRef < PreviewZoomState > ( loadInitialZoom ( ) ) ;
106100 const [ settledZoom , setSettledZoom ] = useState < PreviewZoomState > ( ( ) => zoomRef . current ) ;
@@ -120,7 +114,6 @@ export const NLEPreview = memo(function NLEPreview({
120114 return ( ) => {
121115 if ( settleTimerRef . current ) clearTimeout ( settleTimerRef . current ) ;
122116 if ( hudTimerRef . current ) clearTimeout ( hudTimerRef . current ) ;
123- if ( retiringTimerRef . current ) clearTimeout ( retiringTimerRef . current ) ;
124117 } ;
125118 } , [ ] ) ;
126119
@@ -205,31 +198,13 @@ export const NLEPreview = memo(function NLEPreview({
205198 [ applyTransform ] ,
206199 ) ;
207200
208- if ( refreshKey !== prevRefreshKeyRef . current ) {
209- const oldKey = `${ baseKey } :${ prevRefreshKeyRef . current ?? 0 } ` ;
210- prevRefreshKeyRef . current = refreshKey ;
211- setRetiringKey ( oldKey ) ;
212- }
213-
214- const activeKey = `${ baseKey } :${ refreshKey ?? 0 } ` ;
215-
216201 const applyInitialZoom = useCallback ( ( ) => {
217202 const z = zoomRef . current ;
218203 if ( Math . abs ( z . zoomPercent - 100 ) > 0.5 || Math . abs ( z . panX ) > 0.1 || Math . abs ( z . panY ) > 0.1 ) {
219204 writeTransform ( z ) ;
220205 }
221206 } , [ writeTransform ] ) ;
222207
223- const handleNewPlayerLoad = ( ) => {
224- onIframeLoad ( ) ;
225- applyInitialZoom ( ) ;
226- if ( retiringTimerRef . current ) clearTimeout ( retiringTimerRef . current ) ;
227- retiringTimerRef . current = setTimeout ( ( ) => {
228- setRetiringKey ( null ) ;
229- retiringTimerRef . current = null ;
230- } , 160 ) ;
231- } ;
232-
233208 useEffect ( ( ) => {
234209 const viewport = viewportRef . current ;
235210 if ( ! viewport ) return ;
@@ -412,32 +387,17 @@ export const NLEPreview = memo(function NLEPreview({
412387 } }
413388 data-testid = "preview-zoom-stage"
414389 >
415- { retiringKey && (
416- < Player
417- key = { retiringKey }
418- projectId = { directUrl ? undefined : projectId }
419- directUrl = { directUrl }
420- onLoad = { ( ) => { } }
421- portrait = { portrait }
422- style = { { position : "absolute" , inset : 0 , zIndex : 0 , opacity : 1 } }
423- />
424- ) }
425390 < Player
426391 key = { activeKey }
427392 ref = { iframeRef }
428393 projectId = { directUrl ? undefined : projectId }
429394 directUrl = { directUrl }
430- onLoad = {
431- retiringKey
432- ? handleNewPlayerLoad
433- : ( ) => {
434- onIframeLoad ( ) ;
435- applyInitialZoom ( ) ;
436- }
437- }
395+ onLoad = { ( ) => {
396+ onIframeLoad ( ) ;
397+ applyInitialZoom ( ) ;
398+ } }
438399 onCompositionLoadingChange = { onCompositionLoadingChange }
439400 portrait = { portrait }
440- style = { retiringKey ? { position : "absolute" , inset : 0 , zIndex : 1 } : undefined }
441401 suppressLoadingOverlay = { suppressLoadingOverlay }
442402 />
443403 </ div >
0 commit comments