@sundaeswap/wallet-lite 0.0.44 → 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 +33 -29
- 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,
|
|
@@ -86,7 +87,6 @@ export const useWalletHandles = <
|
|
|
86
87
|
);
|
|
87
88
|
});
|
|
88
89
|
|
|
89
|
-
setIsLoading(false);
|
|
90
90
|
return walletHandles;
|
|
91
91
|
} catch (e) {
|
|
92
92
|
console.error(e);
|
|
@@ -97,27 +97,30 @@ export const useWalletHandles = <
|
|
|
97
97
|
useEffect(() => {
|
|
98
98
|
const fetchHandles = async () => {
|
|
99
99
|
const newHandles = await syncHandles();
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
+
}
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
|
-
}
|
|
115
116
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
if (!handleMetadataChanged) {
|
|
118
|
+
return prevHandles;
|
|
119
|
+
}
|
|
119
120
|
|
|
120
|
-
|
|
121
|
+
return newHandles;
|
|
122
|
+
});
|
|
123
|
+
setIsLoading(() => false);
|
|
121
124
|
});
|
|
122
125
|
};
|
|
123
126
|
|