@exodus/fiat-balances 13.0.0 → 13.0.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/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [13.0.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@13.0.0...@exodus/fiat-balances@13.0.1) (2025-01-02)
7
+
8
+ ### Bug Fixes
9
+
10
+ - fix: memoize selector result (#10901)
11
+
6
12
  ## [13.0.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/fiat-balances@12.5.2...@exodus/fiat-balances@13.0.0) (2024-12-23)
7
13
 
8
14
  ### ⚠ BREAKING CHANGES
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/fiat-balances",
3
- "version": "13.0.0",
3
+ "version": "13.0.1",
4
4
  "description": "Track asset and portfolio fiat balances based on changes in crypto balances and the user's preferred fiat currency",
5
5
  "author": "Exodus Movement, Inc.",
6
6
  "license": "MIT",
@@ -44,7 +44,7 @@
44
44
  "devDependencies": {
45
45
  "@exodus/assets": "^9.1.0",
46
46
  "@exodus/assets-base": "^8.1.17",
47
- "@exodus/assets-feature": "^5.14.1",
47
+ "@exodus/assets-feature": "^6.0.0",
48
48
  "@exodus/available-assets": "^8.7.0",
49
49
  "@exodus/balances": "^13.5.1",
50
50
  "@exodus/blockchain-metadata": "^15.7.1",
@@ -64,5 +64,5 @@
64
64
  "publishConfig": {
65
65
  "access": "public"
66
66
  },
67
- "gitHead": "5e60408602f75be3c7b3961446ec927a4eec5189"
67
+ "gitHead": "1f7245d8d7fa66a2f06faabac3d6380bea289e12"
68
68
  }
@@ -24,8 +24,9 @@ const sortAssetsSelectorFactoryCreator = ({
24
24
  ignoreMarketCapAssets,
25
25
  assetsListSelector,
26
26
  }) =>
27
- memoize((walletAccount) =>
28
- createSelector(
27
+ memoize((walletAccount) => {
28
+ let lastResult
29
+ return createSelector(
29
30
  assetsListSelector,
30
31
  (state) => getAccountAssetsBalanceSelector(state)(walletAccount),
31
32
  (state) => fiatBalancesByAssetSourceSelector(state)[walletAccount],
@@ -78,9 +79,22 @@ const sortAssetsSelectorFactoryCreator = ({
78
79
  })
79
80
 
80
81
  const sorted = orderBy(assetsWithMetaData, SORT_KEYS, SORT_ORDER)
81
- return sorted.map((assetWithMetaData) => assetsMap[assetWithMetaData.name])
82
+ const namesOnly = sorted.map((assetWithMetaData) => assetWithMetaData.name)
83
+ const lastSortedAssetNames = lastResult ? lastResult.map((a) => a.name) : null
84
+ // Compare newResult with lastResult for reference equality
85
+ if (
86
+ lastSortedAssetNames &&
87
+ namesOnly.length === lastSortedAssetNames.length &&
88
+ namesOnly.every((item, i) => item === lastSortedAssetNames[i])
89
+ ) {
90
+ return lastResult
91
+ }
92
+
93
+ lastResult = sorted.map((assetWithMetaData) => assetsMap[assetWithMetaData.name])
94
+
95
+ return lastResult
82
96
  }
83
97
  )
84
- )
98
+ })
85
99
 
86
100
  export default sortAssetsSelectorFactoryCreator