Skip to content

fix(files): render HTML files shared via a public file link - #6363

Merged
TheodoreSpeaks merged 1 commit into
stagingfrom
fix/public-file-html-preview-height
Aug 7, 2026
Merged

fix(files): render HTML files shared via a public file link#6363
TheodoreSpeaks merged 1 commit into
stagingfrom
fix/public-file-html-preview-height

Conversation

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator

Summary

  • HTML files shared via /f/<token> rendered a blank area under the header. The page root (.desktop-title-bar-page) sets only min-height: 100vh, so h-full on every descendant of <main> resolved to auto → 0. HtmlPreview only mounts its sandboxed iframe once its container measures non-zero, so it silently never mounted
  • Gave the public share page root a definite height (h-screen, overflow-hidden) so the whole /f/<token> surface behaves like the in-app viewer; the header's now-dead sticky becomes shrink-0
  • Made the read-only preview chain flex-based (min-h-0 flex-1) instead of h-full, so it fills its parent rather than depending on an ancestor's definite height — covers the HTML, CSV, SVG, and mermaid branches plus the plain-text and loading frames
  • text-editor's preview pane becomes a flex column — it's HtmlPreview's other parent, so flex-1 would have been inert there

Markdown, plain text, CSV, and image shares were unaffected before (their content has intrinsic height) and are unchanged after.

Type of Change

  • Bug fix

Testing

Tested manually against a real local public share, driven headless at 1280x800.

Before (patch reverted on disk), on /f/<token> for a text/html file:

main      1280x736  flex min-h-0 flex-1 flex-col
wrap      1280x0    h-full min-h-0 w-full overflow-auto
container 1280x0    h-full overflow-hidden
iframeCount: 0

After: wrap and container are 1280x736, iframeCount: 1, inline <style> applied, inline script ran under sandbox='allow-scripts', tall content scrolls inside the iframe.

Also confirmed unchanged: CSV, markdown, plain-text, and PNG shares; and the in-app viewer (the other HtmlPreview consumer) — preview mode 1192x834, split mode 595x834 alongside Monaco.

bun run lint, bun run check:audits (22/22), bun run type-check (23/23), and bunx vitest run app/_shell/desktop-title-bar-surfaces.test.ts app/workspace/[workspaceId]/files/components/file-viewer/ all pass.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

The public share page rooted on `.desktop-title-bar-page`, which sets only
`min-height: 100vh`. Without a definite height, `h-full` on every descendant of
`<main>` resolved to `auto` -> 0. `HtmlPreview` gates its sandboxed iframe on a
measured non-zero container, so it silently never mounted and the page rendered
a blank area under the header. Other read-only branches survived because their
content has intrinsic height.

Give the public page root a definite height, and make the read-only preview
chain flex-based so it fills its parent instead of depending on an ancestor's
definite height. `text-editor`'s preview pane becomes a flex column for the same
reason -- it is `HtmlPreview`'s other parent.
@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 7, 2026 2:30am

Request Review

@cursor

cursor Bot commented Aug 7, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Layout-only CSS/flex changes in file viewer and public share UI; no auth, API, or data handling changes.

Overview
Fixes blank HTML previews on public /f/<token> shares: the page root only had min-height: 100vh, so h-full descendants collapsed to zero height and HtmlPreview never mounted its sandboxed iframe.

The public share shell now uses h-screen, overflow-hidden, and a shrink-0 header (replacing ineffective sticky positioning) so <main> gets a definite flex height.

The read-only preview path and PreviewPanel branches (HTML, CSV, SVG, Mermaid) switch from h-full to a flex column with min-h-0 flex-1, so previews fill available space without relying on ancestor height. text-editor’s split preview pane is also a flex column so the same sizing works in-app.

Reviewed by Cursor Bugbot for commit 171ed45. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR repairs HTML rendering on public file links by giving the share surface a definite viewport height and converting the read-only preview chain to flex-based sizing.

  • Makes the public share page a fixed-height flex surface with a non-shrinking header.
  • Lets loading, plain-text, HTML, SVG, Mermaid, and CSV previews consume remaining vertical space.
  • Makes the text editor’s preview pane a flex column so its preview child can grow correctly.

Confidence Score: 5/5

The PR appears safe to merge, with the changed preview layouts consistently backed by definite-height flex ancestors and internal scrolling.

The public and in-app viewer paths provide the flex-column and height constraints required by the new flex-growing preview roots, and no blocking or independently actionable regression remains.

Important Files Changed

Filename Overview
apps/sim/app/f/[token]/public-file-view.tsx Establishes a definite viewport-height flex layout and keeps the public-file header outside the preview’s scrolling region.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/file-viewer.tsx Converts read-only loading, rich-preview, and plain-text containers from percentage-height sizing to remaining-space flex sizing.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/preview-panel.tsx Updates HTML, SVG, Mermaid, and CSV preview roots to grow within flex-based viewer parents.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/text-editor.tsx Makes the editor preview pane a flex column so flex-growing preview implementations receive a valid layout context.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Root[Public share root<br/>h-screen flex-col] --> Header[Header<br/>shrink-0]
  Root --> Main[Main<br/>min-h-0 flex-1 flex-col]
  Main --> Viewer[Read-only FileViewer]
  Viewer --> Wrapper[Preview wrapper<br/>min-h-0 flex-1 flex-col]
  Wrapper --> Preview[HTML / SVG / Mermaid / CSV preview<br/>min-h-0 flex-1]
  Preview --> Scroll[Internal preview scrolling or iframe]
Loading

Reviews (1): Last reviewed commit: "fix(files): render HTML files shared via..." | Re-trigger Greptile

@TheodoreSpeaks
TheodoreSpeaks merged commit 0601fcd into staging Aug 7, 2026
30 checks passed
@TheodoreSpeaks
TheodoreSpeaks deleted the fix/public-file-html-preview-height branch August 7, 2026 02:35
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