@trustless-work/blocks 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -59,16 +59,20 @@ export const EscrowProvider = ({ children }: { children: ReactNode }) => {
|
|
|
59
59
|
const [userRolesInEscrow, setUserRolesInEscrowState] = useState<string[]>([]);
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* Load saved wallet information from localStorage when the component mounts
|
|
63
|
+
* This ensures the wallet state persists across browser sessions
|
|
63
64
|
*/
|
|
64
65
|
useEffect(() => {
|
|
65
66
|
try {
|
|
66
67
|
const stored = localStorage.getItem(LOCAL_STORAGE_KEY);
|
|
67
68
|
if (stored) {
|
|
68
69
|
const parsed: Escrow = JSON.parse(stored);
|
|
70
|
+
// This effect initializes state from localStorage once on mount.
|
|
71
|
+
// It is a controlled sync from an external store, so we allow setState here.
|
|
72
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
69
73
|
setSelectedEscrowState(parsed);
|
|
70
74
|
}
|
|
71
|
-
} catch
|
|
75
|
+
} catch {
|
|
72
76
|
// ignore malformed localStorage content
|
|
73
77
|
}
|
|
74
78
|
}, []);
|
|
@@ -41,7 +41,11 @@ export const WalletProvider = ({ children }: { children: ReactNode }) => {
|
|
|
41
41
|
const storedAddress = localStorage.getItem("walletAddress");
|
|
42
42
|
const storedName = localStorage.getItem("walletName");
|
|
43
43
|
|
|
44
|
+
// This effect initializes state from localStorage once on mount.
|
|
45
|
+
// It is a controlled sync from an external store, so we allow setState here.
|
|
46
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
44
47
|
if (storedAddress) setWalletAddress(storedAddress);
|
|
48
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
45
49
|
if (storedName) setWalletName(storedName);
|
|
46
50
|
}, []);
|
|
47
51
|
|