t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Renewing a workspace HTML preview URL discards form input

Open JDeffner opened this issue 1 month ago • 1 comments

Problem

An interactive HTML workspace preview loses its form input when the signed asset URL renews. This can happen without closing or editing the file. The HTML sandbox blocks localStorage, so a page using that for persistence has no saved copy to restore.

Trigger in current main

Source checked at 1f093d119b:

  1. packages/client-runtime/src/state/assets.ts refreshes subscribed asset URLs every 30 minutes.
  2. WorkspaceBrowserPreview in apps/web/src/components/files/FilePreviewPanel.tsx passes the renewed URL into BrowserDocumentFrame.
  3. BrowserDocumentFrame.tsx uses key={props.src} and src={props.src} on the HTML iframe. A new signature recreates the frame, clearing the document's memory and input fields.

The installed 0.0.45 host (6c8fed35dded) has the same refresh interval and iframe behavior. Its older sandbox additionally blocks downloads, as covered by #14362. That export fix does not fix renewal-driven reloads.

Reproduction

Open a workspace HTML file containing a textarea, enter some text, and leave its Files preview open through an asset-URL renewal. Expected: the existing document and input remain. Actual code path: a new signed URL remounts the frame.

For a deterministic component reproduction, render BrowserDocumentFrame with /assets/token-a/review.html, then update it to /assets/token-b/review.html for the same file revision. The iframe instance and its src both change. A changed file revision should still load the new document; a fresh authorization token should not count as a content change.

Evidence limits

This came from investigating lost feedback in a generated HTML review. The original user-side viewing surface has not been established. I reproduced the sandbox storage error and blocked/exporting download variants through the installed T3 native preview tools, using synthetic input only. The renewal trigger above is from the actual source and a focused component reproduction, not a claim to have recorded the user's original loss or waited 30 minutes in a current-main remote client.

JDeffner avatar Oct 10 '26 06:10 JDeffner

closing as addressed by #17736, merged into main: workspace HTML previews keep the loaded document when only the signed asset URL renews. A resource or revision change still loads a new document, but token renewal no longer clears form input.

thanks for reporting this. if you still face it on a build containing this fix, please ask us to reopen this issue or open a new issue linking back here, with your version, os and reproduction steps.

closed at the request of @UtkarshUsername.

t3-code-bot[bot] avatar Oct 21 '26 09:10 t3-code-bot[bot]