[Bug]: Selecting HTML source makes every later HTML document open as source#16099

opened20d agobyJJDeffner

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web (shared by the desktop client)

Steps to reproduce

  1. Open a local HTML document in the Files panel.
  2. Select Show HTML source.
  3. Open a different HTML document through a normal file link or the Files tree, without a line-number target.
  4. Restart the client and open another HTML document.

The same state can be reproduced in an isolated development client by setting the origin's localStorage["t3code.renderBrowserFile"] to the string "false" and reloading before opening an HTML file.

Expected behavior

Opening a different HTML document starts in rendered view, as described in the user guide. Switching to source applies to the current document. Links to a specific line still open source.

Actual behavior

All later HTML documents open as source, including ordinary links without line targets. The source choice is stored as a global preference and survives restarts. A user who selected source earlier can therefore see raw HTML every time without knowing why.

Impact

Major degradation or frequent failure for reading generated HTML reports.

Version and environment

  • Reported on the Windows desktop client, installed version 0.0.45, commit 6c8fed35dded.
  • Reproduced in an isolated development instance based on v0.0.46-nightly.20261005.2676, commit 7812230572f2.
  • The installed client's stored setting was read without modifying its profile. It contained t3code.renderBrowserFile=false. Copying that value into the isolated client's origin reproduced source view with an existing local HTML report.

Investigation and proposed fix

FilePreviewPanel.tsx reads the source/rendered preference with useLocalStorage and uses it for every HTML document. This is different from the compressed Content-Type failures in #10935/#11935 and the blank desktop iframe in #11191: the viewer deliberately selects source mode here.

Proposed fix: #16071 keeps source mode local to the current document. In the isolated client, the same report rendered after that change while the old global setting remained false. The source toggle and explicit line targets still worked. Four render-state regression tests failed with the old implementation and pass with the proposed change. The report used for this check is private and is not attached.

This proposal changes the scope of the persisted HTML preference; it leaves Markdown and table preferences unchanged. Maintainer review is needed on that behavior choice. The separate Windows Reveal in File Explorer failure is tracked in #11780 and is not fixed by #16071.

Workaround

Select Show rendered page in the HTML viewer. In the current release this updates the global preference, so subsequent ordinary HTML files render until source is selected again.

Reproduced in the Linux web development client on a12d6ed942, using isolated copied state and three synthetic HTML files. A opened rendered; selecting Show HTML source on A then opening B through the Files tree (no line target) showed B as source and stored t3code.renderBrowserFile=false. Reloading the client and opening C also showed source. Windows desktop has not been checked.

B opens as source after selecting source on A