@calimero-network/mero-react 9.1.0 → 9.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/dist/index.cjs CHANGED
@@ -1546,11 +1546,13 @@ function useAsyncResource(fetcher, initialValue, deps) {
1546
1546
  if (mountedRef.current && seq === reqRef.current) setLoading(false);
1547
1547
  }
1548
1548
  }, deps);
1549
- react.useEffect(() => {
1549
+ const prevDeps = react.useRef(deps);
1550
+ if (deps.length !== prevDeps.current.length || deps.some((d, i) => !Object.is(d, prevDeps.current[i]))) {
1551
+ prevDeps.current = deps;
1550
1552
  reqRef.current += 1;
1551
1553
  setData(initialRef.current);
1552
1554
  setError(null);
1553
- }, deps);
1555
+ }
1554
1556
  react.useEffect(() => {
1555
1557
  void refetch();
1556
1558
  }, [refetch]);
@@ -2223,6 +2225,13 @@ function useMemberMetadata(groupId, identity) {
2223
2225
  const [metadata, setMetadata] = react.useState(null);
2224
2226
  const [loading, setLoading] = react.useState(false);
2225
2227
  const [error, setError] = react.useState(null);
2228
+ const prevKey = react.useRef(null);
2229
+ const key = `${groupId ?? ""}:${identity ?? ""}`;
2230
+ if (prevKey.current !== null && prevKey.current !== key) {
2231
+ setMetadata(null);
2232
+ setError(null);
2233
+ }
2234
+ prevKey.current = key;
2226
2235
  const run = react.useCallback(
2227
2236
  async (signal) => {
2228
2237
  if (!mero || !groupId || !identity) {