Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b3e409b
feat: add a loader on sidebar for streaming threads
AbhinRustagi Jul 21, 2026
2ad4e6b
fix: switch to div
AbhinRustagi Jul 21, 2026
93224ef
Merge branch 'main' of github.com:thesysdev/openui into ar-sidebar-st…
AbhinRustagi Jul 21, 2026
e4a6337
fix: update styles
AbhinRustagi Jul 21, 2026
aecc9ef
Merge branch 'main' of github.com:thesysdev/openui into ar-sidebar-st…
AbhinRustagi Jul 21, 2026
9f55ba2
fix: allow background thread streaming
AbhinRustagi Jul 22, 2026
2dc0719
Merge branch 'ar-sidebar-streaming-loader' of github.com:thesysdev/op…
AbhinRustagi Jul 22, 2026
fa77df7
fix: format
AbhinRustagi Jul 22, 2026
27c0baa
fix: remove comments
AbhinRustagi Jul 22, 2026
462dfcd
refactor
AbhinRustagi Jul 22, 2026
f472928
implement lru cache for in-memory threads
AbhinRustagi Jul 22, 2026
99f3b24
fix: update ref
AbhinRustagi Jul 22, 2026
3fc2a2f
add tests for lru
AbhinRustagi Jul 22, 2026
d24763f
fix: format
AbhinRustagi Jul 22, 2026
5305835
Merge branch 'main' of github.com:thesysdev/openui into ar-background…
AbhinRustagi Jul 23, 2026
772fad1
fix: remove lru cache
AbhinRustagi Jul 23, 2026
f7a393a
fix: keep alive only streaming threads
AbhinRustagi Jul 24, 2026
ba932f0
fix: remove unused interfaces
AbhinRustagi Jul 24, 2026
cda326c
fix: format
AbhinRustagi Jul 24, 2026
d39e7f1
Merge branch 'main' of github.com:thesysdev/openui into ar-background…
AbhinRustagi Jul 31, 2026
f9d5f6f
Merge branch 'main' of github.com:thesysdev/openui into ar-background…
AbhinRustagi Aug 4, 2026
3555dd0
fix: css
AbhinRustagi Aug 4, 2026
6d8448d
fix: switch to useThreadState
AbhinRustagi Aug 4, 2026
ff5172b
fix: refactor css
AbhinRustagi Aug 4, 2026
e403b3e
fix: refactor css
AbhinRustagi Aug 4, 2026
5675f3f
fix: format
AbhinRustagi Aug 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/react-headless/src/hooks/useThread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {
type ThreadSlice = ThreadState & ThreadActions;
type ThreadListSlice = ThreadListState & ThreadListActions;

// The active thread lives directly in the store's flat fields.
const threadSelector = (s: ChatStore): ThreadSlice => ({
messages: s.messages,
isRunning: s.isRunning,
Expand All @@ -32,6 +33,7 @@ const threadListSelector = (s: ChatStore): ThreadListSlice => ({
threadListError: s.threadListError,
selectedThreadId: s.selectedThreadId,
hasMoreThreads: s.hasMoreThreads,
isCreatingThread: s.isCreatingThread,
loadThreads: s.loadThreads,
loadMoreThreads: s.loadMoreThreads,
switchToNewThread: s.switchToNewThread,
Expand Down
26 changes: 26 additions & 0 deletions packages/react-headless/src/hooks/useThreadState.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { useStore } from "zustand";
import { useShallow } from "zustand/react/shallow";
import { useChatStore } from "../store/ChatContext";

/**
* Per-thread UI state for a thread **by id** (e.g. a sidebar row). Returns a state
* object rather than a bare value so it can grow more fields without a breaking
* change; for now it exposes only {@link ThreadStateView.isStreaming}.
*/
export interface ThreadStateView {
/** Whether the thread is streaming in the **background** */
isStreaming: boolean;
}

/**
* @category Hooks
*/
export function useThreadState(threadId: string | null): ThreadStateView {
const store = useChatStore();
return useStore(
store,
useShallow((s) => ({
isStreaming: threadId != null && threadId in s.inFlightThreads,
})),
);
}
3 changes: 3 additions & 0 deletions packages/react-headless/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export { useDetailedView } from "./hooks/useDetailedView";
export { useDetailedViewPortalTarget } from "./hooks/useDetailedViewPortalTarget";
export { MessageContext, MessageProvider, useMessage } from "./hooks/useMessage";
export { useThread, useThreadList } from "./hooks/useThread";
export { useThreadState } from "./hooks/useThreadState";
export type { ThreadStateView } from "./hooks/useThreadState";
export { useToolActivities } from "./hooks/useToolActivities";

export { defineArtifactCategories } from "./store/artifactCategories";
Expand Down Expand Up @@ -78,6 +80,7 @@ export type {
ThreadListActions,
ThreadListState,
ThreadState,
ThreadStateEntry,
} from "./store/types";

export type {
Expand Down
Loading
Loading