fix: defer setup wizard HTTP detection to avoid hydration mismatch
This commit is contained in:
+7
-3
@@ -101,10 +101,14 @@ export default function SetupWizardPage() {
|
|||||||
const [config, setConfig] = useState<WizardConfig>(EMPTY_CONFIG);
|
const [config, setConfig] = useState<WizardConfig>(EMPTY_CONFIG);
|
||||||
const [stepIndex, setStepIndex] = useState(0);
|
const [stepIndex, setStepIndex] = useState(0);
|
||||||
const [completed, setCompleted] = useState(false);
|
const [completed, setCompleted] = useState(false);
|
||||||
// Detect synchronously on first client render so the cleartext-credentials
|
// Resolved in a post-mount effect, not at render, so the server-rendered
|
||||||
// warning is in the first paint instead of popping in after hydration.
|
// HTML (where window is absent) matches the client's first paint and
|
||||||
const [insecureContext] = useState<boolean>(detectInsecureContext);
|
// doesn't trip a hydration mismatch.
|
||||||
|
const [insecureContext, setInsecureContext] = useState(false);
|
||||||
const [insecureAcknowledged, setInsecureAcknowledged] = useState(false);
|
const [insecureAcknowledged, setInsecureAcknowledged] = useState(false);
|
||||||
|
useEffect(() => {
|
||||||
|
setInsecureContext(detectInsecureContext());
|
||||||
|
}, []);
|
||||||
|
|
||||||
// ─── Initial status load ────────────────────────────────────────────────
|
// ─── Initial status load ────────────────────────────────────────────────
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user