π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Clear failed Space posts after 2.5 seconds
Anand Baburajanfaff99c66605
diff --git a/web/apps/space/src/hooks/use-own-latest-post.ts b/web/apps/space/src/hooks/use-own-latest-post.tsindex dc04505368..8bbf613ab0 100644--- a/web/apps/space/src/hooks/use-own-latest-post.ts+++ b/web/apps/space/src/hooks/use-own-latest-post.ts@@ -11,6 +11,7 @@ import { useSpaceAppState } from "state/app-state";export const useOwnLatestPost = (spaceId: string | undefined) => {const { postPublication, setPostPublication } = useSpaceAppState();+ const isPublishingPost = postPublication?.phase == "posting";const [ownLatestPost, setOwnLatestPost] = useState<SpacePost>();const [ownPostsVersion, setOwnPostsVersion] = useState(0);const [isOwnLatestPostLoading, setIsOwnLatestPostLoading] = useState(true);@@ -21,7 +22,7 @@ export const useOwnLatestPost = (spaceId: string | undefined) => {setOwnLatestPost(undefined);setIsOwnLatestPostLoading(true);setIsOwnLatestPostUnavailable(false);- if (!spaceId) return;+ if (!spaceId || isPublishingPost) return;let cancelled = false;let cachedPost: SpacePost | undefined;@@ -49,7 +50,7 @@ export const useOwnLatestPost = (spaceId: string | undefined) => {return () => {cancelled = true;};- }, [spaceId, ownPostsVersion]);+ }, [spaceId, ownPostsVersion, isPublishingPost]);const deleteOwnPost = useCallback(async (postId: number) => {diff --git a/web/apps/space/src/state/AppStateProvider.tsx b/web/apps/space/src/state/AppStateProvider.tsxindex e02b2f3317..fdffc096e6 100644--- a/web/apps/space/src/state/AppStateProvider.tsx+++ b/web/apps/space/src/state/AppStateProvider.tsx@@ -81,6 +81,17 @@ export const SpaceAppStateProvider: React.FC<React.PropsWithChildren> = ({[postPreviewUrl],);+ useEffect(() => {+ if (postPublication?.phase != "failed") return;++ const timeoutID = window.setTimeout(() => {+ setPostPublication((current) =>+ current == postPublication ? null : current,+ );+ }, 2500);+ return () => window.clearTimeout(timeoutID);+ }, [postPublication]);+const publishPost = useCallback(async (image: Parameters<SpaceAppState["publishPost"]>[0],