1import { createContext, type ReactNode } from "react";
2
3import { useAppActive } from "../lib/appState";
4
5export const ThreadPrDemandContext = createContext(true);
6
7export function ThreadPrDemandProvider(props: {
8 readonly visible: boolean;
9 readonly children: ReactNode;
10}) {
11 const active = useAppActive();
12 // A sidebar can stay visible beside a focused detail route, so route focus cannot gate its reads.
13 return (
14 <ThreadPrDemandContext value={props.visible && active}>{props.children}</ThreadPrDemandContext>
15 );
16}