Load a saved run's outputs when SSR is on (#13782)
* Load a saved run's outputs when SSR is on
Gradio has two frontend entry points and only the static SPA knew how to
replay a run from the history page. The SSR app never consumed the staged
run, so on Spaces — where SSR is on — "Load run" restored nothing. It
looked like only the outputs were missing, because a run's saved inputs
often match the components' defaults.
The history page itself is always served by the SPA template, so it
staged the run and navigated away to a page that never read it.
Move the write-back into the module that already owns replay staging and
call it from both entry points.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Cover replaying a run end to end, and drop the inline comments
The browser suite runs in both SSR modes, so one spec covers both entry
points. Verified it fails on the SSR leg without the fix.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Assert a replayed run is the run that was clicked
Two runs per test, and both load the earlier one: the app is left showing
the newer run's values, so an assertion on the earlier run's values fails
if the wrong run is replayed or if nothing is replayed at all. Verified
against both — staging the newest run instead reports "second" and
lion.jpg, and dropping the SSR fix reports empty.
The image_mod pair covers media, which is stored as a FileData rather
than a plain value: the restored output has to be the exact file the
earlier run produced.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Scroll the embedding page to the top when the run history opens
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>