Skip to content

editor: the viewer scene header's back arrow is optional - #1008

Open
AxiomeCG wants to merge 2 commits into
pascalorg:mainfrom
AxiomeCG:feat/viewer-embed
Open

AxiomeCG wants to merge 2 commits into
pascalorg:mainfrom
AxiomeCG:feat/viewer-embed

Conversation

@AxiomeCG

@AxiomeCG AxiomeCG commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

ViewerSceneHeader can show no back arrow: backHref: null hides it. An embedded viewer (/viewer/<id>?embed=1 in pascalorg/private-editor#838, which renders the editor's Preview in a listing's iframe) has nowhere to go back to unless the embedding page gives a returnTo. Existing callers pass a string or nothing, so their arrow is unchanged.

How to test

  1. Every current use renders as before: Preview's header still has its back button (onBack), and the public viewer's header still links back (backHref).
  2. With pascalorg/private-editor#838, /viewer/demo_1?embed=1 shows the header with no back arrow, and /viewer/demo_1?embed=1&returnTo=/community shows one linking to /community (its viewer-embed.spec.ts covers both).

Screenshots / screen recording

N/A: the visible change is in #838's embed.

Checklist

  • I've tested this locally with bun dev
  • My code follows the existing code style (run bun check to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch

🤖 Generated with Claude Code


Note

Low Risk
Small conditional UI in the viewer header with no auth or data changes; default back link behavior is preserved.

Overview
ViewerSceneHeader now treats backHref: null as “no back control”: when there is no onBack handler, the header skips the back Link instead of defaulting to /.

The prop type is string | null and the docs call out embedded viewers (e.g. iframe) that may have no sensible return URL unless the parent passes one.

Existing behavior is unchanged for callers that omit backHref (still /) or pass a string; onBack still wins over backHref.

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

`backHref: null` shows no back arrow, for an embedded viewer with nowhere to
go back to. Existing callers keep theirs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pascal

pascal Bot commented Oct 6, 2026

Copy link
Copy Markdown

This PR makes the back arrow in ViewerSceneHeader optional. backHref now accepts string | null, and passing null renders no arrow at all. The default stays '/', so callers that pass a string or omit the prop get the same header as before, and onBack still wins when it's supplied. The motivating case, per the description, is the embedded viewer in pascalorg/private-editor#838 (/viewer/<id>?embed=1), which has nowhere to go back to unless the embedding page supplies a returnTo.

File Change What changed
packages/editor/src/components/viewer/viewer-scene-header.tsx modified backHref widened to string | null, doc comment updated, and the render branch returns null instead of the Link when backHref === null

Start with the render branch around line 111: the new backHref === null ? null : arm is the whole behavior change, and the rest is the type and comment that go with it.

@AxiomeCG
AxiomeCG marked this pull request as draft October 6, 2026 16:38
@AxiomeCG
AxiomeCG marked this pull request as ready for review October 6, 2026 17:54
…irs, pascalorg#996 hosted service contracts) into the embed mode

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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