From 68da2c2c20160b8da1caf6d52ad1476f3866de0a Mon Sep 17 00:00:00 2001 From: Chever John Date: Tue, 30 Jun 2026 02:31:57 +0800 Subject: [PATCH] fix: ShareModal shows blank overlay when factoryId is undefined MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When clicking "分享链接" for unlinked plans, factoryId is undefined. The ShareModal's useEffect returned early without setting hasRelationship, leaving it as null — none of the three conditional branches rendered, showing only the backdrop overlay with no content. Fix: when factoryId is missing, set hasRelationship=false directly to show the share link generation UI. Also remove the factoryId guard from generateShortLink since it only needs planId and factoryType. Co-Authored-By: Claude --- src/components/plans/ShareModal.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/plans/ShareModal.tsx b/src/components/plans/ShareModal.tsx index 00ac76f..bca19a8 100644 --- a/src/components/plans/ShareModal.tsx +++ b/src/components/plans/ShareModal.tsx @@ -75,7 +75,14 @@ export function ShareModal({ // 获取当前用户的公司名称和检查合作关系 useEffect(() => { const fetchData = async () => { - if (!isOpen || !factoryId) return; + if (!isOpen) return; + + // No factoryId means unlinked plan — skip relationship check, go straight to share link + if (!factoryId) { + setHasRelationship(false); + setIsCheckingRelationship(false); + return; + } setIsCheckingRelationship(true); @@ -132,8 +139,6 @@ export function ShareModal({ // 生成短链(30分钟有效) const generateShortLink = useCallback(async () => { - if (!factoryId) return; - setIsGeneratingLink(true); try {