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

803 B
Raw Blame
import { useEffect } from 'react';
import { useAtomValue } from 'jotai';
import { applyUiScale } from '@librechat/client';
import { uiScaleValueAtom } from '~/store/uiScale';

/**
 * Keeps the scale atom mounted so Jotai's storage subscription stays active and a
 * change made in another tab reaches this one. Renders nothing, which confines the
 * re-render to this leaf instead of the provider tree, where the query client is
 * constructed during render.
 */
export default function UiScaleSync(): null {
  const uiScale = useAtomValue(uiScaleValueAtom);

  /** Reconciles the DOM with the stored value on mount, so a corrupted or
   *  out-of-range entry cannot leave the root scale disagreeing with the setting. */
  useEffect(() => {
    applyUiScale(uiScale);
  }, [uiScale]);

  return null;
}