Skip to content

fix(playground): render stored tracking state only in the browser - #234

Merged
sadjow merged 2 commits into
mainfrom
fix/playground-tracking-display
Oct 15, 2026
Merged

sadjow merged 2 commits into
mainfrom
fix/playground-tracking-display

Conversation

@sadjow

@sadjow sadjow commented Oct 14, 2026

Copy link
Copy Markdown
Member

After a reload with tracking disabled, the playground showed "DISABLED" styled green, as if tracking were on. The module's controls worked: enabling, disabling, capturing while disabled, and reloading all stored and skipped visits correctly. Only the playground's display was wrong.

The tracking preference and the history live in localStorage, which only the browser can read, so the server always renders the configured default: enabled, with no history. When the browser has a saved opt-out or stored entries, its first render disagrees with the server's HTML. Vue fixes mismatched text during hydration but keeps the server's class, and it warns that the class mismatch "will not be rectified in production".

The playground now wraps the status label and the collected data panel in <ClientOnly>, as the README recommends for displays of browser history. I drove the playground in Chromium through enabling, disabling, capturing while disabled, clearing, and reloading in each state. Before the change, the label kept the enabled class in five of eleven steps, and the console showed class and text hydration mismatches. After it, the class matched the text at every step and no hydration warnings appeared.

Validation: pnpm format:check, pnpm lint --max-warnings 0, pnpm test, and the playground type check pass.

@sadjow
sadjow merged commit ab16de2 into main Oct 15, 2026
7 checks passed
@sadjow
sadjow deleted the fix/playground-tracking-display branch October 15, 2026 01:45
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