π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix(locker):isolate-discard-dialog-side-effects
Aswin Asok027624a44832
diff --git a/web/apps/locker/src/components/create-item/ItemFormFields.tsx b/web/apps/locker/src/components/create-item/ItemFormFields.tsxindex 7617f2cbc1..98889467a0 100644--- a/web/apps/locker/src/components/create-item/ItemFormFields.tsx+++ b/web/apps/locker/src/components/create-item/ItemFormFields.tsx@@ -12,7 +12,13 @@ import {Typography,} from "@mui/material";import { t } from "i18next";-import React, { useCallback, useMemo, useState } from "react";+import React, {+ useCallback,+ useEffect,+ useMemo,+ useRef,+ useState,+} from "react";export const ItemFormFields: React.FC<{type: LockerItemType;@@ -214,6 +220,14 @@ export const CollectionSelector: React.FC<{const [newlyCreatedCollectionIDs, setNewlyCreatedCollectionIDs] = useState<number[]>([]);+ const mountedRef = useRef(true);++ useEffect(() => {+ mountedRef.current = true;+ return () => {+ mountedRef.current = false;+ };+ }, []);const orderedCollections = useMemo(() => {const sortedCollections = [...collections].sort((a, b) =>@@ -254,6 +268,7 @@ export const CollectionSelector: React.FC<{setCreateError(null);try {const newCollectionID = await onCreateCollection(name);+ if (!mountedRef.current) return;setNewlyCreatedCollectionIDs((current) => [newCollectionID,...current.filter((id) => id !== newCollectionID),diff --git a/web/apps/locker/src/components/ui/LockerConfirmDialog.tsx b/web/apps/locker/src/components/ui/LockerConfirmDialog.tsxindex 4ab5e1119b..563496f6c0 100644--- a/web/apps/locker/src/components/ui/LockerConfirmDialog.tsx+++ b/web/apps/locker/src/components/ui/LockerConfirmDialog.tsx@@ -1,6 +1,7 @@import { lockerSheetContainerSx, lockerSheetPaperSx } from "@/styles/dialog";import {lockerColorSx,+ lockerTextBodyBoldSx,lockerTextBodySx,lockerTextH2Sx,lockerTextMiniSx,@@ -56,6 +57,7 @@ export function LockerConfirmDialog({}: LockerConfirmDialogProps) {const titleID = useId();const bodyID = useId();+ const confirmButtonTypography = cancelLabel ? {} : lockerTextBodyBoldSx;const handleClose = () => {if (!loading) {onClose();@@ -178,6 +180,7 @@ export function LockerConfirmDialog({loading={loading}onClick={onConfirm}sx={(theme) => ({+ ...confirmButtonTypography,mt: 3,minHeight: 52,borderRadius: "20px",