Skip to content

Avoid rewriting localhost links on Connect hosts - #4096

Merged
ymichael merged 3 commits into
mainfrom
bb/explain-localhost-link-rewriting-thr_evnwdy48ra
Sep 22, 2026
Merged

ymichael merged 3 commits into
mainfrom
bb/explain-localhost-link-rewriting-thr_evnwdy48ra

Conversation

@ymichael

@ymichael ymichael commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The localhost-link rewrite replaced localhost with the current page hostname even when bb was opened through Connect. That produced URLs such as http://asdf.getbb.app:5173/app, which are not Connect share URLs and do not work. The setting's description also hid the exact destination at the current app address.

What changed

The rewrite now skips page hostnames matching a code-defined list of patterns for getbb.app and its subdomains. The Links setting shows an example using the current app address when rewriting applies. It is hidden where rewriting has no effect, including getbb.app hosts and the exact localhost hostname. Added regression coverage for getbb.app page hostnames, existing Connect share links, unrelated .localhost hostnames, rewritten-link DOM stability, and setting visibility. No wire, CLI, or configuration changes.

How you verified

  • pnpm exec turbo run test typecheck --filter=@bb/app --filter=@bb/client-core (5,087 app tests passed, 5 skipped; 309 client-core tests passed)
  • Settings description tests cover 127.0.0.1 and .localhost hosts (row with example) and getbb.app hosts (row hidden)
  • Production-style pnpm start:worktree served the final PR head; /settings verified at 127.0.0.1:20300; the current host rules are covered by focused tests
  • git diff --check
  • Final CI on the latest PR head: 14 passed, 2 intentional skips, 0 failures (checks). The app-2 shard passed on rerun after a transient Command Palette test failure; the same shard passed locally with 1,582 tests.

Reviewer handoff and before/after screenshots are stored in BB thread storage under thr_evnwdy48ra/localhost-link-rewrite, outside this PR. Live build through BB Connect

The reported cursor flicker was not reproduced; the DOM stability test covers one plausible remount path.

AGENT GENERATED

@ymichael
ymichael force-pushed the bb/explain-localhost-link-rewriting-thr_evnwdy48ra branch from ae08ce2 to e2c107c Compare September 22, 2026 22:24
@ymichael
ymichael merged commit 3d11a77 into main Sep 22, 2026
16 checks passed
@ymichael
ymichael deleted the bb/explain-localhost-link-rewriting-thr_evnwdy48ra branch September 22, 2026 23:25
danielbachhuber added a commit to danielbachhuber/bb that referenced this pull request Sep 23, 2026
- markdown-preview.test.tsx: this branch's footnote-scroll test and main's
  "keeps a rewritten link mounted across unrelated preview rerenders" test
  (get-bb#4096) were both appended after the same test, which is what conflicted.
  Both are kept.
- markdown-preview.tsx merged cleanly. Main's only change there is a Prettier
  reformat of MarkdownImageProps; the fragment handling already routes
  through rewrittenHref, so localhost rewriting does not affect footnotes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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