feat: add withDocumentTitle reusable#21
Open
Guria wants to merge 1 commit into
Open
Conversation
Atom extension that mirrors a string atom's value into document.title while connected. Sets the title on the first subscriber, tracks changes via addChangeHook, and stops on disconnect. No-ops under SSR (document undefined). Works on any AtomLike<string>, primarily computed titles. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Guria
force-pushed
the
feat/with-document-title
branch
from
July 13, 2026 23:48
33c0cb5 to
d9df3b0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
withDocumentTitle— an atom extension that mirrors a string atom's value intodocument.title.AtomLike<string>, primarily acomputedtitle.withConnectHook: sets the title on first subscriber, tracks changes viaaddChangeHookwhile connected, stops on disconnect. When nothing subscribes,document.titleis left untouched.documentis undefined.src/shared/model/documentTitle.ts) — only the generic connect-hook tail; the app-specific breadcrumb/i18n computed was left behind.Browser test covers immediate-set, update-while-connected, and no-touch-after-unsubscribe; node test covers SSR safety.
🤖 Generated with Claude Code