on main help sign in
refactor(ui): pair markdown cache invalidation with the styles mutation

This is an additional guard to invalidate the cache in the off-chance styles are mutated (rather than updated via applyTheme(), as they should be).

commit1ed6f5248c5eb8d86d002d22578b206a09e2ceed authorChristian Rocha <christian@rocha.is> dateMon 4 May 2026, 11:58 (6 months ago) parent19197e3
1 file changed+4−3
internal/ui/model/ui.go+4−3
internal/ui/model/ui.go+4−3
@@ -3091,10 +3091,12 @@ func (m *UI) cacheSidebarLogo(width int) {
30913091 m.sidebarLogo = renderLogo(m.com.Styles, true, m.com.IsHyper(), width)
30923092}
30933093
3094−// applyTheme replaces the active styles with the given theme and
3095−// refreshes every component that caches style data.
3094+// applyTheme replaces the active styles with the given theme, drops the
3095+// shared markdown renderer cache, and refreshes every component that
3096+// caches style data.
30963097func (m *UI) applyTheme(s styles.Styles) {
30973098 *m.com.Styles = s
3099+ common.InvalidateMarkdownRendererCache()
30983100 m.refreshStyles()
30993101}
31003102
@@ -3116,7 +3118,6 @@ func (m *UI) refreshStyles() {
31163118 )
31173119 m.todoSpinner.Style = t.Pills.TodoSpinner
31183120 m.status.help.Styles = t.Help
3119− common.InvalidateMarkdownRendererCache()
31203121 m.chat.InvalidateRenderCaches()
31213122}
31223123