fix: ShareModal shows blank overlay when factoryId is undefined
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 <noreply@anthropic.com>
This commit is contained in:
parent
31ea850769
commit
68da2c2c20
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user