@calimero-network/mero-react 9.1.0 → 9.1.2

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.js CHANGED
@@ -285,12 +285,20 @@ var isBrowser = typeof window !== "undefined";
285
285
  function getPermissionsForMode(mode) {
286
286
  switch (mode) {
287
287
  case "single-context" /* SingleContext */:
288
- return ["context:execute", "context:list", "application:list", "blob", "context:alias"];
288
+ return [
289
+ "context:execute",
290
+ "context:list",
291
+ "context:subscribe",
292
+ "application:list",
293
+ "blob",
294
+ "context:alias"
295
+ ];
289
296
  case "multi-context" /* MultiContext */:
290
297
  return [
291
298
  "context:create",
292
299
  "context:list",
293
300
  "context:execute",
301
+ "context:subscribe",
294
302
  "application:list",
295
303
  "namespace",
296
304
  "group",
@@ -1546,11 +1554,13 @@ function useAsyncResource(fetcher, initialValue, deps) {
1546
1554
  if (mountedRef.current && seq === reqRef.current) setLoading(false);
1547
1555
  }
1548
1556
  }, deps);
1549
- useEffect(() => {
1557
+ const prevDeps = useRef(deps);
1558
+ if (deps.length !== prevDeps.current.length || deps.some((d, i) => !Object.is(d, prevDeps.current[i]))) {
1559
+ prevDeps.current = deps;
1550
1560
  reqRef.current += 1;
1551
1561
  setData(initialRef.current);
1552
1562
  setError(null);
1553
- }, deps);
1563
+ }
1554
1564
  useEffect(() => {
1555
1565
  void refetch();
1556
1566
  }, [refetch]);
@@ -2223,6 +2233,13 @@ function useMemberMetadata(groupId, identity) {
2223
2233
  const [metadata, setMetadata] = useState(null);
2224
2234
  const [loading, setLoading] = useState(false);
2225
2235
  const [error, setError] = useState(null);
2236
+ const prevKey = useRef(null);
2237
+ const key = `${groupId ?? ""}:${identity ?? ""}`;
2238
+ if (prevKey.current !== null && prevKey.current !== key) {
2239
+ setMetadata(null);
2240
+ setError(null);
2241
+ }
2242
+ prevKey.current = key;
2226
2243
  const run = useCallback(
2227
2244
  async (signal) => {
2228
2245
  if (!mero || !groupId || !identity) {