perf(renderer): reduce costly blur transitions

This commit is contained in:
777genius 2026-04-11 10:05:27 +03:00
parent f1a8a343d4
commit 96739c41fc
9 changed files with 24 additions and 10 deletions

View file

@ -865,7 +865,7 @@ export const ChatHistory = ({ tabId }: ChatHistoryProps): JSX.Element => {
onClick={() => setContextPanelVisible(!isContextPanelVisible)} onClick={() => setContextPanelVisible(!isContextPanelVisible)}
onMouseEnter={() => setIsContextButtonHovered(true)} onMouseEnter={() => setIsContextButtonHovered(true)}
onMouseLeave={() => setIsContextButtonHovered(false)} onMouseLeave={() => setIsContextButtonHovered(false)}
className="pointer-events-auto flex items-center gap-1 rounded-md px-2.5 py-1.5 text-xs shadow-lg backdrop-blur-md transition-colors" className="pointer-events-auto flex items-center gap-1 rounded-md px-2.5 py-1.5 text-xs shadow-lg transition-colors"
style={{ style={{
backgroundColor: isContextPanelVisible backgroundColor: isContextPanelVisible
? 'var(--context-btn-active-bg)' ? 'var(--context-btn-active-bg)'
@ -997,7 +997,7 @@ export const ChatHistory = ({ tabId }: ChatHistoryProps): JSX.Element => {
scrollToBottom('smooth'); scrollToBottom('smooth');
setShowScrollButton(false); setShowScrollButton(false);
}} }}
className="absolute bottom-5 z-20 flex items-center gap-1.5 rounded-full px-3 py-1.5 text-xs shadow-lg backdrop-blur-md transition-all" className="absolute bottom-5 z-20 flex items-center gap-1.5 rounded-full px-3 py-1.5 text-xs shadow-lg transition-colors"
style={{ style={{
right: '1rem', right: '1rem',
backgroundColor: 'var(--context-btn-bg)', backgroundColor: 'var(--context-btn-bg)',

View file

@ -76,7 +76,7 @@ const ChatHistoryItemInner = ({
return ( return (
<div <div
ref={registerChatItemRef(item.group.id)} ref={registerChatItemRef(item.group.id)}
className={`rounded-lg transition-all ease-out ${hl.className} ${enterClass}`} className={`rounded-lg transition-[background-color,box-shadow] ease-out ${hl.className} ${enterClass}`}
style={{ ...transitionStyle, ...(hl.style ?? {}) }} style={{ ...transitionStyle, ...(hl.style ?? {}) }}
> >
<UserChatGroup userGroup={item.group} /> <UserChatGroup userGroup={item.group} />
@ -94,7 +94,7 @@ const ChatHistoryItemInner = ({
return ( return (
<div <div
ref={registerChatItemRef(item.group.id)} ref={registerChatItemRef(item.group.id)}
className={`rounded-lg transition-all ease-out ${hl.className} ${enterClass}`} className={`rounded-lg transition-[background-color,box-shadow] ease-out ${hl.className} ${enterClass}`}
style={{ ...transitionStyle, ...(hl.style ?? {}) }} style={{ ...transitionStyle, ...(hl.style ?? {}) }}
> >
<SystemChatGroup systemGroup={item.group} /> <SystemChatGroup systemGroup={item.group} />
@ -116,7 +116,7 @@ const ChatHistoryItemInner = ({
return ( return (
<div <div
ref={registerAIGroupRef(item.group.id)} ref={registerAIGroupRef(item.group.id)}
className={`rounded-lg transition-all ease-out ${hl.className} ${enterClass}`} className={`rounded-lg transition-[background-color,box-shadow] ease-out ${hl.className} ${enterClass}`}
style={{ ...transitionStyle, ...(hl.style ?? {}) }} style={{ ...transitionStyle, ...(hl.style ?? {}) }}
> >
<AIChatGroup <AIChatGroup

View file

@ -100,7 +100,7 @@ export const BaseItem: React.FC<BaseItemProps> = ({
}) => { }) => {
return ( return (
<div <div
className={`rounded transition-all duration-300 ${highlightClasses}`} className={`rounded transition-[background-color,box-shadow] duration-300 ${highlightClasses}`}
style={highlightStyle} style={highlightStyle}
> >
{/* Clickable Header */} {/* Clickable Header */}

View file

@ -152,7 +152,6 @@ export const MetricsPill = ({
style={{ style={{
...tooltipStyle, ...tooltipStyle,
border: `1px solid ${TAG_BORDER}`, border: `1px solid ${TAG_BORDER}`,
backdropFilter: 'blur(8px)',
}} }}
onMouseEnter={handleMouseEnter} onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave} onMouseLeave={handleMouseLeave}

View file

@ -265,7 +265,7 @@ export const SubagentItem: React.FC<SubagentItemProps> = ({
return ( return (
<div <div
ref={outerCardRef} ref={outerCardRef}
className={`overflow-hidden rounded-md transition-all duration-300 ${outerHighlight.className}`} className={`overflow-hidden rounded-md transition-[background-color,box-shadow] duration-300 ${outerHighlight.className}`}
style={{ style={{
backgroundColor: CARD_BG, backgroundColor: CARD_BG,
border: CARD_BORDER_STYLE, border: CARD_BORDER_STYLE,

View file

@ -145,7 +145,7 @@ export const TeammateMessageItem: React.FC<TeammateMessageItemProps> = ({
return ( return (
<div <div
className={`overflow-hidden rounded-md transition-all duration-300 ${highlightClasses}`} className={`overflow-hidden rounded-md transition-[background-color,box-shadow] duration-300 ${highlightClasses}`}
style={{ style={{
backgroundColor: CARD_BG, backgroundColor: CARD_BG,
border: CARD_BORDER_STYLE, border: CARD_BORDER_STYLE,

View file

@ -443,7 +443,7 @@ export const CommandPalette = (): React.JSX.Element | null => {
return ( return (
<div <div
role="presentation" role="presentation"
className="fixed inset-0 z-50 flex items-start justify-center bg-black/60 pt-[15vh] backdrop-blur-sm" className="fixed inset-0 z-50 flex items-start justify-center bg-black/60 pt-[15vh]"
onClick={handleBackdropClick} onClick={handleBackdropClick}
> >
<div className="w-full max-w-2xl overflow-hidden rounded-xl border border-border bg-surface shadow-2xl"> <div className="w-full max-w-2xl overflow-hidden rounded-xl border border-border bg-surface shadow-2xl">

View file

@ -89,12 +89,24 @@ export function useTheme(): {
// Apply theme class to document root // Apply theme class to document root
useEffect(() => { useEffect(() => {
const root = document.documentElement; const root = document.documentElement;
const body = document.body;
body.classList.add('theme-transitioning');
// Remove existing theme classes // Remove existing theme classes
root.classList.remove('dark', 'light'); root.classList.remove('dark', 'light');
// Add new theme class // Add new theme class
root.classList.add(resolvedTheme); root.classList.add(resolvedTheme);
const timer = window.setTimeout(() => {
body.classList.remove('theme-transitioning');
}, 250);
return () => {
window.clearTimeout(timer);
body.classList.remove('theme-transitioning');
};
}, [resolvedTheme]); }, [resolvedTheme]);
return { return {

View file

@ -763,6 +763,9 @@ body {
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
background-color: var(--color-surface); background-color: var(--color-surface);
color: var(--color-text); color: var(--color-text);
}
body.theme-transitioning {
transition: transition:
background-color 0.2s ease, background-color 0.2s ease,
color 0.2s ease; color 0.2s ease;