on main help sign in
fix(tui): splash: cache logo rendering on resize

Only re-render the logo when the width changes.

commit85b13fcd8100d9752b10865d97f672eb25e7f63e authorAyman Bagabas <ayman.bagabas@gmail.com> dateThu 17 Jul 2025, 13:27 (1 year ago) parent2a8998e
1 file changed+4−1
internal/tui/components/chat/splash/splash.go+4−1
internal/tui/components/chat/splash/splash.go+4−1
@@ -133,9 +133,12 @@ func (s *splashCmp) Init() tea.Cmd {
133133
134134// SetSize implements SplashPage.
135135func (s *splashCmp) SetSize(width int, height int) tea.Cmd {
136+ rerenderLogo := width != s.width
136137 s.height = height
137138 s.width = width
138− s.logoRendered = s.logoBlock()
139+ if rerenderLogo {
140+ s.logoRendered = s.logoBlock()
141+ }
139142 // remove padding, logo height, gap, title space
140143 s.listHeight = s.height - lipgloss.Height(s.logoRendered) - (SplashScreenPaddingY * 2) - s.logoGap() - 2
141144 listWidth := min(60, width)