Memoize agent object in AgentPanelBody to prevent WebStreamViewport re-renders on keystroke
This commit is contained in:
@@ -483,7 +483,8 @@ function AgentPanelBody({
|
|||||||
isPendingCreateForPanel && (!authoritativeStatus || isAuthoritativeBootstrapping);
|
isPendingCreateForPanel && (!authoritativeStatus || isAuthoritativeBootstrapping);
|
||||||
const canFinalizePendingCreate = Boolean(authoritativeStatus) && !isAuthoritativeBootstrapping;
|
const canFinalizePendingCreate = Boolean(authoritativeStatus) && !isAuthoritativeBootstrapping;
|
||||||
|
|
||||||
const agent: AgentScreenAgent | null =
|
const agent = useMemo<AgentScreenAgent | null>(
|
||||||
|
() =>
|
||||||
agentState.serverId && agentState.id && agentState.status && agentState.cwd
|
agentState.serverId && agentState.id && agentState.status && agentState.cwd
|
||||||
? {
|
? {
|
||||||
serverId: agentState.serverId,
|
serverId: agentState.serverId,
|
||||||
@@ -492,7 +493,9 @@ function AgentPanelBody({
|
|||||||
cwd: agentState.cwd,
|
cwd: agentState.cwd,
|
||||||
projectPlacement,
|
projectPlacement,
|
||||||
}
|
}
|
||||||
: null;
|
: null,
|
||||||
|
[agentState.serverId, agentState.id, agentState.status, agentState.cwd, projectPlacement],
|
||||||
|
);
|
||||||
|
|
||||||
const placeholderAgent: AgentScreenAgent | null = useMemo(() => {
|
const placeholderAgent: AgentScreenAgent | null = useMemo(() => {
|
||||||
if (!shouldUseOptimisticStream || !agentId) {
|
if (!shouldUseOptimisticStream || !agentId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user