@sundaeswap/wallet-lite 0.0.45 → 0.0.46
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/dist/cjs/react-components/hooks/useWalletHandles.js +30 -26
- package/dist/cjs/react-components/hooks/useWalletHandles.js.map +1 -1
- package/dist/esm/react-components/hooks/useWalletHandles.js +17 -15
- package/dist/esm/react-components/hooks/useWalletHandles.js.map +1 -1
- package/dist/types/react-components/hooks/useWalletHandles.d.ts.map +1 -1
- package/dist/types/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/react-components/hooks/useWalletHandles.ts +21 -18
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
startTransition,
|
|
2
3
|
useCallback,
|
|
3
4
|
useDeferredValue,
|
|
4
5
|
useEffect,
|
|
@@ -96,29 +97,31 @@ export const useWalletHandles = <
|
|
|
96
97
|
useEffect(() => {
|
|
97
98
|
const fetchHandles = async () => {
|
|
98
99
|
const newHandles = await syncHandles();
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
100
|
+
startTransition(() => {
|
|
101
|
+
setHandles((prevHandles) => {
|
|
102
|
+
let handleMetadataChanged = false;
|
|
103
|
+
|
|
104
|
+
if (newHandles.size !== prevHandles?.size) {
|
|
105
|
+
handleMetadataChanged = true;
|
|
106
|
+
} else {
|
|
107
|
+
for (const [key, val] of newHandles) {
|
|
108
|
+
if (
|
|
109
|
+
!prevHandles.has(key) ||
|
|
110
|
+
prevHandles.get(key)?.amount !== val?.amount
|
|
111
|
+
) {
|
|
112
|
+
handleMetadataChanged = true;
|
|
113
|
+
}
|
|
111
114
|
}
|
|
112
115
|
}
|
|
113
|
-
}
|
|
114
116
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
if (!handleMetadataChanged) {
|
|
118
|
+
return prevHandles;
|
|
119
|
+
}
|
|
118
120
|
|
|
119
|
-
|
|
121
|
+
return newHandles;
|
|
122
|
+
});
|
|
123
|
+
setIsLoading(() => false);
|
|
120
124
|
});
|
|
121
|
-
setIsLoading(false);
|
|
122
125
|
};
|
|
123
126
|
|
|
124
127
|
fetchHandles();
|