@calimero-network/mero-react 2.6.0 → 2.6.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/dist/index.cjs +32 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -29
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2107,39 +2107,42 @@ function useMemberMetadata(groupId, identity) {
|
|
|
2107
2107
|
const [metadata, setMetadata] = react.useState(null);
|
|
2108
2108
|
const [loading, setLoading] = react.useState(false);
|
|
2109
2109
|
const [error, setError] = react.useState(null);
|
|
2110
|
-
const
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
}
|
|
2120
|
-
if (mountedRef.current) {
|
|
2121
|
-
setLoading(true);
|
|
2122
|
-
setError(null);
|
|
2123
|
-
}
|
|
2124
|
-
try {
|
|
2125
|
-
const result = await mero.admin.getMemberMetadata(groupId, identity);
|
|
2126
|
-
if (mountedRef.current) {
|
|
2127
|
-
setMetadata(result);
|
|
2110
|
+
const run = react.useCallback(
|
|
2111
|
+
async (signal) => {
|
|
2112
|
+
if (!mero || !groupId || !identity) {
|
|
2113
|
+
if (!signal.aborted) {
|
|
2114
|
+
setMetadata(null);
|
|
2115
|
+
setError(null);
|
|
2116
|
+
setLoading(false);
|
|
2117
|
+
}
|
|
2118
|
+
return;
|
|
2128
2119
|
}
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
setError(errorValue);
|
|
2120
|
+
if (!signal.aborted) {
|
|
2121
|
+
setLoading(true);
|
|
2122
|
+
setError(null);
|
|
2133
2123
|
}
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2124
|
+
try {
|
|
2125
|
+
const result = await mero.admin.getMemberMetadata(groupId, identity);
|
|
2126
|
+
if (!signal.aborted) setMetadata(result);
|
|
2127
|
+
} catch (err) {
|
|
2128
|
+
if (!signal.aborted) setError(toError(err));
|
|
2129
|
+
} finally {
|
|
2130
|
+
if (!signal.aborted) setLoading(false);
|
|
2137
2131
|
}
|
|
2138
|
-
}
|
|
2139
|
-
|
|
2132
|
+
},
|
|
2133
|
+
[mero, groupId, identity]
|
|
2134
|
+
);
|
|
2140
2135
|
react.useEffect(() => {
|
|
2141
|
-
|
|
2142
|
-
|
|
2136
|
+
const signal = { aborted: false };
|
|
2137
|
+
void run(signal);
|
|
2138
|
+
return () => {
|
|
2139
|
+
signal.aborted = true;
|
|
2140
|
+
};
|
|
2141
|
+
}, [run]);
|
|
2142
|
+
const refetch = react.useCallback(async () => {
|
|
2143
|
+
const signal = { aborted: false };
|
|
2144
|
+
await run(signal);
|
|
2145
|
+
}, [run]);
|
|
2143
2146
|
return { metadata, loading, error, refetch };
|
|
2144
2147
|
}
|
|
2145
2148
|
function useRegisterGroupSigningKey() {
|