From aba6330db77d538c2fe3fbd44b21fa05785b44a8 Mon Sep 17 00:00:00 2001 From: Chever John Date: Tue, 30 Jun 2026 02:58:39 +0800 Subject: [PATCH] fix: eliminate blank overlay flash when opening ShareModal Initialize hasRelationship and isCheckingRelationship based on whether factoryId is present, so the first render frame already shows the correct content instead of an empty backdrop overlay. Co-Authored-By: Claude --- src/components/plans/ShareModal.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/plans/ShareModal.tsx b/src/components/plans/ShareModal.tsx index bca19a8..7dbb2ac 100644 --- a/src/components/plans/ShareModal.tsx +++ b/src/components/plans/ShareModal.tsx @@ -66,8 +66,10 @@ export function ShareModal({ const shortLinkGenerated = useRef(false); // 新流程状态 - const [hasRelationship, setHasRelationship] = useState(null); - const [isCheckingRelationship, setIsCheckingRelationship] = useState(false); + // When no factoryId (unlinked plan), we already know there's no relationship + // so initialize directly to avoid a blank-overlay flash before useEffect runs. + const [hasRelationship, setHasRelationship] = useState(factoryId ? null : false); + const [isCheckingRelationship, setIsCheckingRelationship] = useState(!!factoryId); const [existingLink, setExistingLink] = useState(null); const [isGeneratingLink, setIsGeneratingLink] = useState(false); const [pushSuccess, setPushSuccess] = useState(false);