mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-06-30 20:39:46 +02:00
Fix copilot suppressing sidebar issues
This commit is contained in:
parent
62dc05e36a
commit
df2d004d7c
2 changed files with 34 additions and 8 deletions
|
|
@ -184,6 +184,22 @@ const App = forwardRef<{ handleCopyChat: () => void; handleUserMessage: (message
|
||||||
handleUserMessage
|
handleUserMessage
|
||||||
}), [handleCopyChat, handleUserMessage]);
|
}), [handleCopyChat, handleUserMessage]);
|
||||||
|
|
||||||
|
// Memoized status bar change handler to prevent infinite update loop
|
||||||
|
const handleStatusBarChange = useCallback((status: any) => {
|
||||||
|
setStatusBar((prev: any) => {
|
||||||
|
// Shallow compare previous and next status
|
||||||
|
const next = { ...status, context: lockedContext };
|
||||||
|
const keys = Object.keys(next);
|
||||||
|
if (
|
||||||
|
prev &&
|
||||||
|
keys.every(key => prev[key] === next[key])
|
||||||
|
) {
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
return next;
|
||||||
|
});
|
||||||
|
}, [lockedContext]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CopilotContext.Provider value={{ workflow: workflowRef.current, dispatch }}>
|
<CopilotContext.Provider value={{ workflow: workflowRef.current, dispatch }}>
|
||||||
<div className="h-full flex flex-col">
|
<div className="h-full flex flex-col">
|
||||||
|
|
@ -194,10 +210,7 @@ const App = forwardRef<{ handleCopyChat: () => void; handleUserMessage: (message
|
||||||
loadingResponse={loadingResponse}
|
loadingResponse={loadingResponse}
|
||||||
workflow={workflowRef.current}
|
workflow={workflowRef.current}
|
||||||
dispatch={dispatch}
|
dispatch={dispatch}
|
||||||
onStatusBarChange={status => setStatusBar({
|
onStatusBarChange={handleStatusBarChange}
|
||||||
...status,
|
|
||||||
context: lockedContext,
|
|
||||||
})}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="shrink-0 px-1 pb-6">
|
<div className="shrink-0 px-1 pb-6">
|
||||||
|
|
|
||||||
|
|
@ -413,9 +413,14 @@ function AssistantMessage({
|
||||||
const [panelOpen, setPanelOpen] = useState(false); // collapsed by default
|
const [panelOpen, setPanelOpen] = useState(false); // collapsed by default
|
||||||
|
|
||||||
// At the end of the render, call onStatusBarChange with the current status bar props
|
// At the end of the render, call onStatusBarChange with the current status bar props
|
||||||
|
// Track the latest status bar info
|
||||||
|
const latestStatusBar = useRef<any>(null);
|
||||||
|
|
||||||
|
// Only call onStatusBarChange if the serializable status actually changes
|
||||||
|
const lastStatusRef = useRef<any>(null);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (onStatusBarChange) {
|
if (onStatusBarChange) {
|
||||||
onStatusBarChange({
|
const status = {
|
||||||
allCardsLoaded,
|
allCardsLoaded,
|
||||||
allApplied,
|
allApplied,
|
||||||
appliedCount,
|
appliedCount,
|
||||||
|
|
@ -423,10 +428,18 @@ function AssistantMessage({
|
||||||
streamingLine,
|
streamingLine,
|
||||||
completedSummary,
|
completedSummary,
|
||||||
hasPanelWarning,
|
hasPanelWarning,
|
||||||
handleApplyAll,
|
// Exclude handleApplyAll from comparison
|
||||||
});
|
};
|
||||||
|
if (!lastStatusRef.current || JSON.stringify(lastStatusRef.current) !== JSON.stringify(status)) {
|
||||||
|
lastStatusRef.current = status;
|
||||||
|
onStatusBarChange({
|
||||||
|
...status,
|
||||||
|
handleApplyAll, // pass the function, but don't compare it
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [allCardsLoaded, allApplied, appliedCount, pendingCount, streamingLine, completedSummary, hasPanelWarning, handleApplyAll, onStatusBarChange]);
|
// Only depend on the serializable values, not the function
|
||||||
|
}, [allCardsLoaded, allApplied, appliedCount, pendingCount, streamingLine, completedSummary, hasPanelWarning, onStatusBarChange, handleApplyAll]);
|
||||||
|
|
||||||
// Render all cards inline, not in a panel
|
// Render all cards inline, not in a panel
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue