import { useStateStore } from './useStateStore';
import { useThreadListItemContext } from '../ThreadList';
import { useThreadContext } from '../ThreadContext';
/**
 * @description returns thread state, prioritizes `ThreadListItemContext` falls back to `ThreadContext` if not former is not present
 */
export const useThreadState = (selector) => {
    const listItemThread = useThreadListItemContext();
    const thread = useThreadContext();
    return useStateStore(listItemThread?.state ?? thread?.state, selector);
};
