injectThreadRouting
Bind an app-owned activeThreadId signal to the URL — restore on load, stamp on change,
validate-or-redirect, with a bare URL meaning "no thread" (welcome). URL is the source of
truth; nothing is written to localStorage. Must be called in an injection context.
import { injectThreadRouting } from '@threadplane/chat';Declaration · overload 1
export declare function injectThreadRouting(config: ThreadRoutingConfig): void;Parameters
config· requiredThreadRoutingConfig
Returns
voidExamples
export const ACTIVE_THREAD = signal<string | null>(null);
// providers: provideAgent({ threadId: ACTIVE_THREAD, onThreadId: id => ACTIVE_THREAD.set(id) })
const threads = inject(LangGraphThreadsAdapter);
injectThreadRouting({ threadId: ACTIVE_THREAD, validate: id => threads.getThread(id).then(Boolean) });