Skip to content

fix(share): shared links lose links under custom token separators (BLD-214) - #21

Merged
dani-polani merged 2 commits into
mainfrom
fix/bld-214-share-link-links
Sep 29, 2026
Merged

dani-polani merged 2 commits into
mainfrom
fix/bld-214-share-link-links

Conversation

@dani-polani

Copy link
Copy Markdown
Member

Problem

A user reported that shared links restore only the first link group. Their payload contains all six connections and "sp":"|-"; the diagram's middle line is split with -.

Fixes

Links pruned before the link's settings load. The home page hydrated the project first. loadSnapshotV2 pruned connections against tokens built with the default separators (| only), so the --split line was a single token and every link past t-0 was dropped. settingsStore.load ran afterwards, too late. New projectStore.loadState loads settings first; the home page, loadExample, and ExamplePreviewEmbed all go through it.

Merge char lost when it is the only changed setting. compact-v4 wrote mg only alongside another non-default setting, so a link where only the join character changed decoded back to +. Token count is unaffected, so links survived, but token text rendered wrong. Existing payloads are byte-identical; only merge-char-only states now emit s.

Tests

  • project-load-state.test.ts: encodes a three-line diagram with - as a separator, decodes it, loads it. With the old hydration order it keeps 2 of 6 links, matching the user's video; with loadState it keeps all 6.
  • Round-trip test for a merge char of _ and empty as the only non-default setting.

vitest (205 passed), svelte-check, prettier, and eslint are clean. Not checked in a browser.

🤖 Generated with Claude Code

dani-polani and others added 2 commits September 29, 2026 02:58
Hydration loaded the project before the link's settings, so connections
were pruned against tokens built with the default separators. A diagram
that split a line with a custom separator such as `-` lost every link
past that line's first token.

Add projectStore.loadState, which loads settings first, and route the
home page, examples, and gallery previews through it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The compact wire wrote `mg` only alongside another non-default setting,
so a link where only the join character changed decoded back to `+`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@dani-polani
dani-polani merged commit 3d56aac into main Sep 29, 2026
2 checks passed
@dani-polani
dani-polani deleted the fix/bld-214-share-link-links branch September 29, 2026 00:01
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