Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

579 B
Raw Blame
let pendingChatFocus = false;

/**
 * Transient cross-navigation focus intent for the chat composer. Carried
 * outside `location.state` so consuming it needs no second state-clearing
 * navigation, which doubled every router-context sweep per conversation
 * switch; being transient, it also never re-fires from history entries on
 * back/forward navigation.
 */
export const requestChatFocus = (): void => {
  pendingChatFocus = true;
};

export const consumeChatFocus = (): boolean => {
  const requested = pendingChatFocus;
  pendingChatFocus = false;
  return requested;
};