fix(files): render HTML files shared via a public file link - #6363
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview The public share shell now uses The read-only preview path and Reviewed by Cursor Bugbot for commit 171ed45. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThe 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.
Confidence Score: 5/5The 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.
|
| 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]
Reviews (1): Last reviewed commit: "fix(files): render HTML files shared via..." | Re-trigger Greptile
Summary
/f/<token>rendered a blank area under the header. The page root (.desktop-title-bar-page) sets onlymin-height: 100vh, soh-fullon every descendant of<main>resolved toauto→ 0.HtmlPreviewonly mounts its sandboxed iframe once its container measures non-zero, so it silently never mountedh-screen,overflow-hidden) so the whole/f/<token>surface behaves like the in-app viewer; the header's now-deadstickybecomesshrink-0min-h-0 flex-1) instead ofh-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 framestext-editor's preview pane becomes a flex column — it'sHtmlPreview's other parent, soflex-1would have been inert thereMarkdown, plain text, CSV, and image shares were unaffected before (their content has intrinsic height) and are unchanged after.
Type of Change
Testing
Tested manually against a real local public share, driven headless at 1280x800.
Before (patch reverted on disk), on
/f/<token>for atext/htmlfile:After:
wrapandcontainerare1280x736,iframeCount: 1, inline<style>applied, inline script ran undersandbox='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
HtmlPreviewconsumer) — preview mode 1192x834, split mode 595x834 alongside Monaco.bun run lint,bun run check:audits(22/22),bun run type-check(23/23), andbunx vitest run app/_shell/desktop-title-bar-surfaces.test.ts app/workspace/[workspaceId]/files/components/file-viewer/all pass.Checklist