Keep shared Rule files reachable, and say when a privacy change does not save.

This commit is contained in:
adilallo committed 2026-11-09 20:05:06 -07:00
1 parent b6795c1f18
commit 63ba21c614
9 files changed
+148 -16

No files matched your search

@@ -65,6 +65,7 @@ const ShareContainer = memo<ShareProps>((props) => {
const [inviteError, setInviteError] = useState<string | null>(null);
const [turnOnBusy, setTurnOnBusy] = useState(false);
const [linkCopied, setLinkCopied] = useState(false);
const [saveFailed, setSaveFailed] = useState(false);
useCreateModalA11y(isOpen, onClose, dialogRef);
@@ -76,6 +77,7 @@ const ShareContainer = memo<ShareProps>((props) => {
setInviteError(null);
setLinkCopied(false);
setTurnOnBusy(false);
setSaveFailed(false);
if (!previewSettings) setSettings(null);
return;
}
@@ -106,6 +108,7 @@ const ShareContainer = memo<ShareProps>((props) => {
setSettings(next);
setPhase("idle");
setCommunityAgreed(false);
setSaveFailed(false);
}, []);
const handleSelectValue = useCallback(
@@ -132,7 +135,11 @@ const ShareContainer = memo<ShareProps>((props) => {
}
void (async () => {
const res = await patchRuleShare(ruleId, "private");
if (res.ok) applySettings(res.share);
if (res.ok) {
applySettings(res.share);
return;
}
setSaveFailed(true);
})();
return;
}
@@ -146,6 +153,7 @@ const ShareContainer = memo<ShareProps>((props) => {
}
setPhase("confirm");
setCommunityAgreed(false);
setSaveFailed(false);
}
},
[applySettings, phase, ruleId, settings],
@@ -185,7 +193,11 @@ const ShareContainer = memo<ShareProps>((props) => {
return;
}
const res = await patchRuleShare(ruleId, "private");
if (res.ok) applySettings(res.share);
if (res.ok) {
applySettings(res.share);
return;
}
setSaveFailed(true);
}, [applySettings, ruleId, settings]);
const handleInvite = useCallback(async () => {
@@ -274,6 +286,7 @@ const ShareContainer = memo<ShareProps>((props) => {
turnOnDisabled
turnOnBusy={false}
showError={false}
showSaveError={false}
copyEnabled={false}
linkCopied={false}
onCopyLink={() => undefined}
@@ -327,6 +340,7 @@ const ShareContainer = memo<ShareProps>((props) => {
turnOnDisabled={!communityAgreed}
turnOnBusy={turnOnBusy}
showError={phase === "error"}
showSaveError={saveFailed}
copyEnabled={copyEnabled}
linkCopied={linkCopied}
onCopyLink={() => void handleCopyLink()}