@lifi/widget 3.27.0 → 3.27.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 +8 -0
- package/dist/esm/components/Chains/VirtualizedChainList.js +17 -9
- package/dist/esm/components/Chains/VirtualizedChainList.js.map +1 -1
- package/dist/esm/components/Routes/RoutesContent.d.ts +1 -1
- package/dist/esm/components/Routes/RoutesExpanded.js +7 -3
- package/dist/esm/components/Routes/RoutesExpanded.js.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/package.json +5 -5
- package/package.json.tmp +5 -5
- package/src/components/Chains/VirtualizedChainList.tsx +21 -9
- package/src/components/Routes/RoutesContent.tsx +1 -1
- package/src/components/Routes/RoutesExpanded.tsx +7 -3
- package/src/config/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [3.27.1](https://github.com/lifinance/widget/compare/v3.27.0...v3.27.1) (2025-08-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* improve cache handling for fetched routes ([#508](https://github.com/lifinance/widget/issues/508)) ([0814365](https://github.com/lifinance/widget/commit/0814365d8be5e1e0499fb166edf0049203407aa1))
|
|
11
|
+
* scroll to index retry warnings ([#504](https://github.com/lifinance/widget/issues/504)) ([bc958eb](https://github.com/lifinance/widget/commit/bc958eb6f182a8b2986fe8a9dc54c14f52174d8a))
|
|
12
|
+
|
|
5
13
|
## [3.27.0](https://github.com/lifinance/widget/compare/v3.26.1...v3.27.0) (2025-08-11)
|
|
6
14
|
|
|
7
15
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
3
|
-
import { useCallback, useEffect,
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { useChainOrderStore } from '../../stores/chains/ChainOrderStore';
|
|
5
5
|
import { List } from './ChainList.style';
|
|
6
6
|
import { ChainListItem } from './ChainListItem';
|
|
@@ -29,7 +29,7 @@ export const VirtualizedChainList = ({ chains, onSelect, selectedChainId, itemsS
|
|
|
29
29
|
const getItemKey = useCallback((index) => {
|
|
30
30
|
return `${sortedChains[index].id}-${index}`;
|
|
31
31
|
}, [sortedChains]);
|
|
32
|
-
const { getVirtualItems, getTotalSize, measure,
|
|
32
|
+
const { getVirtualItems, getTotalSize, measure, range, getOffsetForIndex } = useVirtualizer({
|
|
33
33
|
count: sortedChains.length,
|
|
34
34
|
overscan: 3,
|
|
35
35
|
paddingEnd: 0,
|
|
@@ -48,7 +48,20 @@ export const VirtualizedChainList = ({ chains, onSelect, selectedChainId, itemsS
|
|
|
48
48
|
measure();
|
|
49
49
|
}
|
|
50
50
|
}, [measure, scrollElementRef.current]);
|
|
51
|
-
|
|
51
|
+
const scrollToIndex = useCallback((index) => {
|
|
52
|
+
requestAnimationFrame(() => {
|
|
53
|
+
const offsetInfo = getOffsetForIndex(index, 'center');
|
|
54
|
+
if (!scrollElementRef.current || !offsetInfo) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
scrollElementRef.current.scrollTo({
|
|
58
|
+
top: offsetInfo[0],
|
|
59
|
+
left: 0,
|
|
60
|
+
behavior: 'smooth',
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}, [getOffsetForIndex, scrollElementRef.current]);
|
|
64
|
+
useEffect(() => {
|
|
52
65
|
// Only scroll if sortedChains is not empty and we haven't scrolled yet
|
|
53
66
|
if (!hasScrolledRef.current && sortedChains.length > 0 && range) {
|
|
54
67
|
const selectedChainIndex = sortedChains.findIndex((chain) => chain.id === selectedChainIdRef.current);
|
|
@@ -57,12 +70,7 @@ export const VirtualizedChainList = ({ chains, onSelect, selectedChainId, itemsS
|
|
|
57
70
|
// +1 and -1 to account for partially visible items
|
|
58
71
|
if (range.startIndex + 1 > selectedChainIndex ||
|
|
59
72
|
range.endIndex - 1 < selectedChainIndex) {
|
|
60
|
-
|
|
61
|
-
scrollToIndex(selectedChainIndex, {
|
|
62
|
-
align: 'center',
|
|
63
|
-
behavior: 'smooth',
|
|
64
|
-
});
|
|
65
|
-
});
|
|
73
|
+
scrollToIndex(selectedChainIndex);
|
|
66
74
|
}
|
|
67
75
|
}
|
|
68
76
|
hasScrolledRef.current = true; // Mark as scrolled (when needed)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizedChainList.js","sourceRoot":"","sources":["../../../../src/components/Chains/VirtualizedChainList.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"VirtualizedChainList.js","sourceRoot":"","sources":["../../../../src/components/Chains/VirtualizedChainList.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAW/C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACnC,MAAM,EACN,QAAQ,EACR,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,gBAAgB,GACU,EAAE,EAAE;IAC9B,MAAM,kBAAkB,GAAG,MAAM,CAAC,eAAe,CAAC,CAAA,CAAC,6EAA6E;IAChI,MAAM,cAAc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,EAAE,KAAK,IATP,IAAI,CAAC,GAAG,CAUb,CACH,CAAA;QACH,CAAC,CAAC,GACG,CACR,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -14,13 +14,17 @@ export const RoutesExpanded = memo(function RoutesExpanded({ canOpen, setOpenExp
|
|
|
14
14
|
const routesRef = useRef(undefined);
|
|
15
15
|
const routesActiveRef = useRef(false);
|
|
16
16
|
const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, fromChain, refetch, setReviewableRoute, } = useRoutes();
|
|
17
|
-
const onExit = () => {
|
|
17
|
+
const onExit = useCallback(() => {
|
|
18
18
|
// Clean routes cache on exit
|
|
19
19
|
routesRef.current = undefined;
|
|
20
|
-
};
|
|
20
|
+
}, []);
|
|
21
21
|
// We cache routes results in ref for a better exit animation
|
|
22
22
|
if (routesRef.current && !routes) {
|
|
23
23
|
routesActiveRef.current = false;
|
|
24
|
+
// If we are loading routes with a new queryKey, we need to clear the cache
|
|
25
|
+
if (isLoading) {
|
|
26
|
+
routesRef.current = undefined;
|
|
27
|
+
}
|
|
24
28
|
}
|
|
25
29
|
else {
|
|
26
30
|
routesRef.current = routes;
|
|
@@ -43,6 +47,6 @@ export const RoutesExpanded = memo(function RoutesExpanded({ canOpen, setOpenExp
|
|
|
43
47
|
useEffect(() => {
|
|
44
48
|
emitter.emit(WidgetEvent.WidgetExpanded, expanded);
|
|
45
49
|
}, [emitter, expanded]);
|
|
46
|
-
return (_jsx(ExpansionTransition, { in: expanded, width: routesExpansionWidth, onExited: onExit, children: _jsx(RoutesContent, { routes: routesRef.current
|
|
50
|
+
return (_jsx(ExpansionTransition, { in: expanded, width: routesExpansionWidth, onExited: onExit, children: _jsx(RoutesContent, { routes: routesRef.current, isFetching: isFetching, isLoading: isLoading, dataUpdatedAt: dataUpdatedAt, refetchTime: refetchTime, fromChain: fromChain, refetch: refetch, onRouteClick: onRouteClick }) }));
|
|
47
51
|
});
|
|
48
52
|
//# sourceMappingURL=RoutesExpanded.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RoutesExpanded.js","sourceRoot":"","sources":["../../../../src/components/Routes/RoutesExpanded.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAOhE,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,cAAc,CAAC,EACzD,OAAO,EACP,gBAAgB,GACI;IACpB,MAAM,OAAO,GAAG,eAAe,EAAE,CAAA;IACjC,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;IAC9B,MAAM,SAAS,GAAG,MAAM,CAAU,SAAS,CAAC,CAAA;IAC5C,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAErC,MAAM,EACJ,MAAM,EACN,SAAS,EACT,UAAU,EACV,SAAS,EACT,aAAa,EACb,WAAW,EACX,SAAS,EACT,OAAO,EACP,kBAAkB,GACnB,GAAG,SAAS,EAAE,CAAA;IAEf,MAAM,MAAM,GAAG,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"RoutesExpanded.js","sourceRoot":"","sources":["../../../../src/components/Routes/RoutesExpanded.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,WAA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,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,GAC1B,GACkB,CACvB,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "3.27.
|
|
2
|
+
export declare const version = "3.27.1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "3.27.
|
|
3
|
+
"version": "3.27.1",
|
|
4
4
|
"description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/esm/index.js",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"@bigmi/core": "^0.4.3",
|
|
35
35
|
"@emotion/react": "^11.14.0",
|
|
36
36
|
"@emotion/styled": "^11.14.1",
|
|
37
|
-
"@lifi/sdk": "^3.9.
|
|
37
|
+
"@lifi/sdk": "^3.9.2",
|
|
38
38
|
"@mui/icons-material": "^7.3.1",
|
|
39
39
|
"@mui/material": "^7.3.1",
|
|
40
40
|
"@mui/system": "^7.3.1",
|
|
41
|
-
"@mysten/sui": "^1.37.
|
|
41
|
+
"@mysten/sui": "^1.37.2",
|
|
42
42
|
"@solana/wallet-adapter-base": "^0.9.27",
|
|
43
43
|
"@solana/wallet-adapter-coinbase": "^0.1.23",
|
|
44
44
|
"@solana/web3.js": "^1.98.4",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"react-transition-group": "^4.4.5",
|
|
53
53
|
"viem": "^2.33.3",
|
|
54
54
|
"zustand": "^5.0.7",
|
|
55
|
-
"@lifi/wallet-management": "^3.14.
|
|
55
|
+
"@lifi/wallet-management": "^3.14.3"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@bigmi/react": ">=0.4.0",
|
|
59
|
-
"@mysten/dapp-kit": ">=0.
|
|
59
|
+
"@mysten/dapp-kit": ">=0.17.0",
|
|
60
60
|
"@solana/wallet-adapter-react": ">=0.15.35",
|
|
61
61
|
"@tanstack/react-query": ">=5.68.0",
|
|
62
62
|
"react": ">=18",
|
package/package.json.tmp
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "3.27.
|
|
3
|
+
"version": "3.27.1",
|
|
4
4
|
"description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
"@bigmi/core": "^0.4.3",
|
|
54
54
|
"@emotion/react": "^11.14.0",
|
|
55
55
|
"@emotion/styled": "^11.14.1",
|
|
56
|
-
"@lifi/sdk": "^3.9.
|
|
56
|
+
"@lifi/sdk": "^3.9.2",
|
|
57
57
|
"@lifi/wallet-management": "workspace:^",
|
|
58
58
|
"@mui/icons-material": "^7.3.1",
|
|
59
59
|
"@mui/material": "^7.3.1",
|
|
60
60
|
"@mui/system": "^7.3.1",
|
|
61
|
-
"@mysten/sui": "^1.37.
|
|
61
|
+
"@mysten/sui": "^1.37.2",
|
|
62
62
|
"@solana/wallet-adapter-base": "^0.9.27",
|
|
63
63
|
"@solana/wallet-adapter-coinbase": "^0.1.23",
|
|
64
64
|
"@solana/web3.js": "^1.98.4",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@types/react-transition-group": "^4.4.12",
|
|
78
|
-
"cpy-cli": "^
|
|
78
|
+
"cpy-cli": "^6.0.0",
|
|
79
79
|
"madge": "^8.0.0",
|
|
80
80
|
"react": "^19.1.1",
|
|
81
81
|
"react-dom": "^19.1.1",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"@bigmi/react": ">=0.4.0",
|
|
87
|
-
"@mysten/dapp-kit": ">=0.
|
|
87
|
+
"@mysten/dapp-kit": ">=0.17.0",
|
|
88
88
|
"@solana/wallet-adapter-react": ">=0.15.35",
|
|
89
89
|
"@tanstack/react-query": ">=5.68.0",
|
|
90
90
|
"react": ">=18",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtendedChain } from '@lifi/sdk'
|
|
2
2
|
import { useVirtualizer } from '@tanstack/react-virtual'
|
|
3
3
|
import type { RefObject } from 'react'
|
|
4
|
-
import { useCallback, useEffect,
|
|
4
|
+
import { useCallback, useEffect, useMemo, useRef } from 'react'
|
|
5
5
|
import { useChainOrderStore } from '../../stores/chains/ChainOrderStore'
|
|
6
6
|
import { List } from './ChainList.style'
|
|
7
7
|
import { ChainListItem } from './ChainListItem'
|
|
@@ -56,7 +56,7 @@ export const VirtualizedChainList = ({
|
|
|
56
56
|
[sortedChains]
|
|
57
57
|
)
|
|
58
58
|
|
|
59
|
-
const { getVirtualItems, getTotalSize, measure,
|
|
59
|
+
const { getVirtualItems, getTotalSize, measure, range, getOffsetForIndex } =
|
|
60
60
|
useVirtualizer({
|
|
61
61
|
count: sortedChains.length,
|
|
62
62
|
overscan: 3,
|
|
@@ -78,7 +78,24 @@ export const VirtualizedChainList = ({
|
|
|
78
78
|
}
|
|
79
79
|
}, [measure, scrollElementRef.current])
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
const scrollToIndex = useCallback(
|
|
82
|
+
(index: number) => {
|
|
83
|
+
requestAnimationFrame(() => {
|
|
84
|
+
const offsetInfo = getOffsetForIndex(index, 'center')
|
|
85
|
+
if (!scrollElementRef.current || !offsetInfo) {
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
scrollElementRef.current.scrollTo({
|
|
89
|
+
top: offsetInfo[0],
|
|
90
|
+
left: 0,
|
|
91
|
+
behavior: 'smooth',
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
},
|
|
95
|
+
[getOffsetForIndex, scrollElementRef.current]
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
useEffect(() => {
|
|
82
99
|
// Only scroll if sortedChains is not empty and we haven't scrolled yet
|
|
83
100
|
if (!hasScrolledRef.current && sortedChains.length > 0 && range) {
|
|
84
101
|
const selectedChainIndex = sortedChains.findIndex(
|
|
@@ -91,12 +108,7 @@ export const VirtualizedChainList = ({
|
|
|
91
108
|
range.startIndex + 1 > selectedChainIndex ||
|
|
92
109
|
range.endIndex - 1 < selectedChainIndex
|
|
93
110
|
) {
|
|
94
|
-
|
|
95
|
-
scrollToIndex(selectedChainIndex, {
|
|
96
|
-
align: 'center',
|
|
97
|
-
behavior: 'smooth',
|
|
98
|
-
})
|
|
99
|
-
})
|
|
111
|
+
scrollToIndex(selectedChainIndex)
|
|
100
112
|
}
|
|
101
113
|
}
|
|
102
114
|
hasScrolledRef.current = true // Mark as scrolled (when needed)
|
|
@@ -14,7 +14,7 @@ import { RouteNotFoundCard } from '../RouteCard/RouteNotFoundCard.js'
|
|
|
14
14
|
import { Container, Header } from './RoutesExpanded.style.js'
|
|
15
15
|
|
|
16
16
|
interface RoutesContentProps {
|
|
17
|
-
routes
|
|
17
|
+
routes?: Route[]
|
|
18
18
|
isFetching: boolean
|
|
19
19
|
isLoading: boolean
|
|
20
20
|
dataUpdatedAt: number
|
|
@@ -35,14 +35,18 @@ export const RoutesExpanded = memo(function RoutesExpanded({
|
|
|
35
35
|
setReviewableRoute,
|
|
36
36
|
} = useRoutes()
|
|
37
37
|
|
|
38
|
-
const onExit = () => {
|
|
38
|
+
const onExit = useCallback(() => {
|
|
39
39
|
// Clean routes cache on exit
|
|
40
40
|
routesRef.current = undefined
|
|
41
|
-
}
|
|
41
|
+
}, [])
|
|
42
42
|
|
|
43
43
|
// We cache routes results in ref for a better exit animation
|
|
44
44
|
if (routesRef.current && !routes) {
|
|
45
45
|
routesActiveRef.current = false
|
|
46
|
+
// If we are loading routes with a new queryKey, we need to clear the cache
|
|
47
|
+
if (isLoading) {
|
|
48
|
+
routesRef.current = undefined
|
|
49
|
+
}
|
|
46
50
|
} else {
|
|
47
51
|
routesRef.current = routes
|
|
48
52
|
routesActiveRef.current = Boolean(routes)
|
|
@@ -80,7 +84,7 @@ export const RoutesExpanded = memo(function RoutesExpanded({
|
|
|
80
84
|
onExited={onExit}
|
|
81
85
|
>
|
|
82
86
|
<RoutesContent
|
|
83
|
-
routes={routesRef.current
|
|
87
|
+
routes={routesRef.current}
|
|
84
88
|
isFetching={isFetching}
|
|
85
89
|
isLoading={isLoading}
|
|
86
90
|
dataUpdatedAt={dataUpdatedAt}
|
package/src/config/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget'
|
|
2
|
-
export const version = '3.27.
|
|
2
|
+
export const version = '3.27.1'
|