Skip to content

fix: don't reset chart zoom when toggling signal visibility - #189

Merged
tzebrowski merged 1 commit into
mainfrom
fix/chart-zoom-reset-on-signal-toggle
Aug 14, 2026
Merged

fix: don't reset chart zoom when toggling signal visibility#189
tzebrowski merged 1 commit into
mainfrom
fix/chart-zoom-reset-on-signal-toggle

Conversation

@tzebrowski

Copy link
Copy Markdown
Owner

buildDataset() and the legend labels.filter callback both read appState.isSignalVisible() (backed by the hiddenSignalKeys signal) synchronously during Chart.js construction inside the chart-view effect that rebuilds (destroy + new Chart) on structural changes. Since Angular effects track every signal read during their synchronous execution -- including reads from nested calls -- this made the rebuild effect implicitly depend on hiddenSignalKeys too, so simply checking another signal in the sidebar list destroyed and recreated every chart, discarding zoom/pan state. Wrap both reads in untracked() so visibility toggles are only handled by the dedicated hiddenSignalKeys effect (syncVisibility), which already updates existing datasets in place.

buildDataset() and the legend labels.filter callback both read
appState.isSignalVisible() (backed by the hiddenSignalKeys signal)
synchronously during Chart.js construction inside the chart-view
effect that rebuilds (destroy + new Chart) on structural changes.
Since Angular effects track every signal read during their synchronous
execution -- including reads from nested calls -- this made the
rebuild effect implicitly depend on hiddenSignalKeys too, so simply
checking another signal in the sidebar list destroyed and recreated
every chart, discarding zoom/pan state. Wrap both reads in untracked()
so visibility toggles are only handled by the dedicated
hiddenSignalKeys effect (syncVisibility), which already updates
existing datasets in place.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@tzebrowski
tzebrowski merged commit 2f9c4c6 into main Aug 14, 2026
4 checks passed
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