mirror of
				https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
				synced 2025-11-04 08:13:43 +08:00 
			
		
		
		
	fix: resolve hydration error
This commit is contained in:
		@@ -1,4 +1,3 @@
 | 
			
		||||
import type { ChatRequest } from "../chat/typing";
 | 
			
		||||
import { createParser } from "eventsource-parser";
 | 
			
		||||
import { NextRequest } from "next/server";
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -465,6 +465,16 @@ function showMemoryPrompt(session: ChatSession) {
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const useHasHydrated = () => {
 | 
			
		||||
  const [hasHydrated, setHasHydrated] = useState<boolean>(false);
 | 
			
		||||
 | 
			
		||||
  useEffect(() => {
 | 
			
		||||
    setHasHydrated(true);
 | 
			
		||||
  }, []);
 | 
			
		||||
 | 
			
		||||
  return hasHydrated;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export function Home() {
 | 
			
		||||
  const [createNewSession, currentIndex, removeSession] = useChatStore(
 | 
			
		||||
    (state) => [
 | 
			
		||||
@@ -473,7 +483,7 @@ export function Home() {
 | 
			
		||||
      state.removeSession,
 | 
			
		||||
    ]
 | 
			
		||||
  );
 | 
			
		||||
  const loading = !useChatStore?.persist?.hasHydrated();
 | 
			
		||||
  const loading = !useHasHydrated();
 | 
			
		||||
  const [showSideBar, setShowSideBar] = useState(true);
 | 
			
		||||
 | 
			
		||||
  // setting
 | 
			
		||||
 
 | 
			
		||||
@@ -354,7 +354,7 @@ export function Settings(props: { closeSettings: () => void }) {
 | 
			
		||||
            <input
 | 
			
		||||
              type="number"
 | 
			
		||||
              min={100}
 | 
			
		||||
              max={4000}
 | 
			
		||||
              max={4096}
 | 
			
		||||
              value={config.modelConfig.max_tokens}
 | 
			
		||||
              onChange={(e) =>
 | 
			
		||||
                updateConfig(
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										0
									
								
								app/components/userRole.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								app/components/userRole.tsx
									
									
									
									
									
										Normal file
									
								
							
		Reference in New Issue
	
	Block a user