feat(atproto-comments): add no-JS hosted comments and CDN proxy#11
Merged
Conversation
…crash The client build bundled its own Svelte runtime. In a SvelteKit/Vite app — which has its own Svelte — that put two Svelte runtimes on the page, and under `experimental.async` the app's async-boundary hydration would cross into the component's separate runtime and dereference a null effect, crashing with "Cannot read properties of null (reading 'f')" and wiping a correctly server-rendered thread (#7). Emit `dist/client-svelte`/`dist/server-svelte` (Svelte marked external) and declare a `svelte` export condition pointing at them, so bundler consumers dedupe the component onto the app's single Svelte runtime. The default `dist/client` (Svelte bundled) is unchanged and still serves the CDN / bare-`import` drop-in, which has no app Svelte to dedupe against. The vendored direct-props HydrationHost is now applied to every build variant (matched by outDir/entry rather than array index). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W9oixH2t2npbf9u3ara93J
The local copy of @svebcomponents/ssr's HydrationHost existed only to read
`props.__x` instead of destructuring `$props()`, which under an earlier ssr
release produced writable prop signals with no parent effect and broke
hydration before the user's component mounted.
That no longer reproduces on the current pin (svelte 5.56.4, ssr 0.3.1).
Verified by building against upstream's host and running the hydrate-in-place
e2e with the async SSR wrapper and `experimental.async` both off (the shipped
config) and both on (the config the workaround was written for): the SSR'd
shadow DOM is claimed in place either way, with no console or page errors.
Removing it also removes the build-config aliasing that kept every build
variant pointed at the local file, so the component tracks upstream's host
automatically from here on. Note the e2e only exercises the bundler path
(dist/client-svelte / dist/server-svelte); the bundled CDN build has no
coverage yet.
Also fix two bugs in the "stays reactive" e2e, which was failing on main:
- it asserted the reply button's visible text was "Reply", but the button
renders the reply-count glyph ("↩ 3") and carries "Reply" as its accessible
name. Assert the accessible name, which does not move with the live thread.
- it then checked `shadowRoot.querySelector("dialog")` — the first dialog in
document order, belonging to the root post, not to the comment whose button
it clicked. It was asserting `open: true` on a dialog nothing had touched.
Resolve the clicked button's `commandfor` and assert against that dialog.
The trailing Esc check had the same bug and was passing vacuously against an
already-closed dialog; it now proves Esc closes the dialog that was open.
And reformat a code-snippet line in the host's landing page that prettier had
been failing on (whitespace inside a tag; no rendered change), so `pnpm -r
lint` is green again.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EpWk46Sjx5E5SR12MtBTKs
0.3.4 carries two upstream fixes this component needed (svebcomponents/svebcomponents#126, #128): browser bundles now resolve against the `production` export condition, so Svelte's dev-only error and warning message texts no longer ship, and the `hydratable` wrapper is bundled rather than left as a bare specifier the CDN drop-in could not resolve. dist/client is 93.6 kB -> 83.4 kB raw and self-contained again. svebcomponents.config.ts only restated what the CLI already infers from package.json `exports` — inference produces byte-identical output, and additionally threads svelte.config.js through, which the hand-written config did not. rollup.config.js was dead; the CLI only ever looks for `svebcomponents.config`. Also drops ServiceClient's unused `hasToken` getter. Class members are never tree-shaken, so it shipped in every bundle touching ServiceClient. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EpWk46Sjx5E5SR12MtBTKs
…dual-svelte-runtime # Conflicts: # apps/host/src/routes/+page.svelte # components/atproto-comments/svebcomponents.config.ts
Theo-Steiner
marked this pull request as ready for review
July 26, 2026 03:06
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.
What changed
@svebcomponents/build0.3.4Why
The initial Svelte-runtime hydration fix was merged in #8, but the follow-up work on this branch was never merged. These changes make the hosted component more resilient, simplify its build setup, and provide a stable first-party URL for CDN consumers.
Conflict resolution
Merged the latest
maininto the branch. The host-page conflict keeps the branch's first-partyhttps://atproto.svebcomponents.dev/cdnURL. The modify/delete conflict keepssvebcomponents.config.tsdeleted because build 0.3.4 now infers the equivalent configuration and includes the upstream hydration fixes.Validation
pnpm checkpnpm testpnpm buildAll passed with the repository-declared pnpm 10.8.0.