You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(theme): eliminate continuous QueryaHighlightController recreation during AnimatedQueryaTheme transitions #1358
During theme transitions (switching between light/dark mode or selecting a new theme), AnimatedQueryaTheme (in lib/core/theme/animated_querya_theme.dart) interpolates QueryaTheme.lerp(a, b, t) across frames over themeDuration (200–300 ms).
Inside QueryaCodeEditor.build() (lib/core/editor/querya_code_editor.dart, lines 148–175): _ensureHighlightController(context.queryaTheme) checks:
Because editor colors are lerped on every frame (60 to 144 times/sec), _highlightEditorTheme == editor evaluates to false on every single frame of the animation.
Consequently:
_disposeHighlight() is called.
SyntaxHighlightService.createPair is called with newly lerped hex colors, missing the LRU cache and evicting entries from the 12-slot _pairCache.
A brand new QueryaHighlightController is instantiated, and listeners are re-wired.
For every open SQL tab, the controller is destroyed and recreated 18 to 36 times during a single 300 ms transition.
Proposed Solution
Update editor wrapper and token colors in-place on the existing QueryaHighlightController without disposing and recreating the controller.
Only recreate the controller when the target theme definition, language, or grammar actually changes, ignoring intermediate lerp frames.
Prevent cache pollution in SyntaxHighlightService._pairCache by avoiding cache lookups for transient lerped themes.
Acceptance Criteria
Switching themes does not dispose and recreate QueryaHighlightController on every intermediate animation frame.
Theme transitions with multiple open SQL editor tabs run smoothly at 60/120 Hz without frame drops.
Activity
ZhuchkaTriplesix commentedon Oct 11, 2026
Done in #1402 (merged into
dev).