mirror of
https://github.com/logseq/logseq.git
synced 2026-05-30 07:29:48 +00:00
fix: page-title avatar updates on theme toggle
Extends the previous theme-toggle fix to cover the page-title render path. `block.cljs:3223` (page-title) routes through `icon-picker` → `icon-picker-trigger-icon` → `(icon …)`, bypassing `get-node-icon-cp` entirely. The earlier `(state/sub :ui/theme)` on `get-node-icon-cp` covered the sidebar, cmdk, breadcrumb, and inline page references, but the page-title's reactive boundary is `icon-picker-trigger-icon` — which only subscribed to `:ui/icon-hover-preview`, not theme. Result: page-title avatars with user-picked custom hex colors (which get contrast-adjusted differently per theme via `adjust-for-contrast`) stayed frozen with the previous theme's tone until something else triggered a re-render. One-line patch: add `_theme (state/sub :ui/theme)` to the trigger's let block. The subscribed value is discarded; the subscription is just there to tick Rum's dependency graph when the user hits `t t`. Known follow-up: same pattern exists in other less-trafficked render paths (avatar-cp picker-tile, custom-tab-cp preview, asset-picker customize-band, and a handful of external callers in property/value, property, property/config, views). They'll exhibit the same staleness but only when visible — most are picker-internal (rare during theme toggle). Best addressed in a focused refactor that extracts the avatar-only and colored-icon branches of `icon` into reactive subcomponents, killing the bug class at the right abstraction layer. Filed for after this PR lands. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -6970,6 +6970,14 @@
|
||||
trigger only reflects previews from a Default-Icon-scoped picker."
|
||||
[icon-value preview-target-db-id icon-props & [property]]
|
||||
(let [property (or property :logseq.property/icon)
|
||||
;; Re-render on theme toggle so the inline `style="background-
|
||||
;; color:#...;color:#..."` produced by `avatar-fallback-style`
|
||||
;; recomputes against the new theme's CSS variables. The
|
||||
;; page-title (`block.cljs:3223`) routes through `icon-picker`
|
||||
;; → this trigger and bypasses `get-node-icon-cp` entirely, so
|
||||
;; the `:ui/theme` sub on get-node-icon-cp (icon.cljs:913)
|
||||
;; doesn't cover the page-title path.
|
||||
_theme (state/sub :ui/theme)
|
||||
preview (when preview-target-db-id (state/sub :ui/icon-hover-preview))
|
||||
preview-active? (and preview
|
||||
(icon-preview-matches? preview preview-target-db-id property))
|
||||
|
||||
Reference in New Issue
Block a user