@ludo.ninja/components 2.1.62 → 2.1.63

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.
@@ -1,4 +1,4 @@
1
- import { identitySchema as schema } from '@ludo.ninja/api';
1
+ import { identitySchema as schema } from "@ludo.ninja/api";
2
2
  declare const useFetchUserWallets: ({ userId }: schema.IQueryFetchUserWalletsArgs) => {
3
3
  refetch: (variables?: Partial<schema.Exact<{
4
4
  userId: schema.Scalars["ID"];
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const api_1 = require("@ludo.ninja/api");
4
+ const react_1 = require("react");
4
5
  const useFetchUserWallets = ({ userId }) => {
5
6
  const { loading, error, data, refetch } = api_1.identitySchema.useFetchUserWalletsQuery({
6
7
  variables: { userId },
@@ -8,13 +9,16 @@ const useFetchUserWallets = ({ userId }) => {
8
9
  uri: api_1.hosts.identityHost,
9
10
  },
10
11
  });
12
+ const userWallets = (0, react_1.useMemo)(() => {
13
+ return (data?.fetchUserWallets
14
+ ?.slice()
15
+ .sort((wallet, nextWallet) => Number(nextWallet?.mainWallet) - Number(wallet?.mainWallet)) || null);
16
+ }, [data]);
11
17
  return {
12
18
  refetch,
13
19
  loading,
14
20
  error,
15
- userWallets: data?.fetchUserWallets
16
- ?.slice()
17
- .sort((wallet, nextWallet) => Number(nextWallet?.mainWallet) - Number(wallet?.mainWallet)) || null,
21
+ userWallets,
18
22
  };
19
23
  };
20
24
  exports.default = useFetchUserWallets;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludo.ninja/components",
3
- "version": "2.1.62",
3
+ "version": "2.1.63",
4
4
  "private": false,
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",