Skip to content

perf(studio): lightweight preview reload and skip asset overlay on refreshes#892

Closed
miguel-heygen wants to merge 2 commits into
feat/studio-copy-paste-corefrom
perf/studio-preview-reload
Closed

perf(studio): lightweight preview reload and skip asset overlay on refreshes#892
miguel-heygen wants to merge 2 commits into
feat/studio-copy-paste-corefrom
perf/studio-preview-reload

Conversation

@miguel-heygen
Copy link
Copy Markdown
Collaborator

Summary

Stacked on #891.

  • Lightweight iframe reload: Content refreshes (paste, move, resize, delete) now use refreshPlayer() (iframe.src with cache-busting param) instead of destroying and recreating the entire Player web component via React key change. No more full teardown + crossfade animation + re-initialization.
  • Skip asset overlay on reloads: The "Preparing preview assets" overlay only shows on the initial cold load. Subsequent reloads skip it since assets are browser-cached, eliminating the disruptive loading flash.

Test plan

  • Build passes, lint clean
  • Manual: paste/delete/move clips — no "waiting for media" flash, playhead position preserved

…rdown

Content refreshes (paste, move, resize, delete, asset drop) previously
triggered setRefreshKey which changed the Player's React key, causing
full web-component destruction + iframe teardown + crossfade animation
+ re-initialization of all event listeners and asset polling.

Now NLELayout intercepts refreshKey changes and calls refreshPlayer()
which just appends a cache-busting _t param to the iframe src. The
Player web component stays alive, event listeners persist, and the
reload is ~10x faster with no "waiting for media" flash.

Key-based teardown is preserved for actual structural changes (project
switch, composition drill-down via directUrl change).
The asset-loading overlay ("Preparing preview assets") polled for
video/audio readyState on every iframe load, including content
refreshes from paste/move/resize. On reloads the browser serves
assets from cache so they resolve near-instantly — the overlay
just created a disruptive flash. Now skips the polling on
subsequent loads (loadCountRef > 1), only showing it on the
initial cold load.
@miguel-heygen
Copy link
Copy Markdown
Collaborator Author

Moving to Graphite stack

@miguel-heygen miguel-heygen deleted the perf/studio-preview-reload branch May 16, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant