@silentswap/react 0.0.84 → 0.0.86
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.
|
@@ -32,10 +32,6 @@ export function SwapFormEstimatesProvider({ children, tokenIn, fetchEstimates, s
|
|
|
32
32
|
const rafScheduledRef = useRef(false);
|
|
33
33
|
const pendingUpdateRef = useRef(null);
|
|
34
34
|
const isManualDestinationChangeRef = useRef(false);
|
|
35
|
-
// Update fetchEstimates ref
|
|
36
|
-
React.useEffect(() => {
|
|
37
|
-
fetchEstimatesRef.current = fetchEstimates;
|
|
38
|
-
}, [fetchEstimates]);
|
|
39
35
|
// Debounced fetch estimates
|
|
40
36
|
const scheduleFetchEstimates = useCallback((immediate = false, direction) => {
|
|
41
37
|
if (isDraggingSlider) {
|
|
@@ -74,6 +70,19 @@ export function SwapFormEstimatesProvider({ children, tokenIn, fetchEstimates, s
|
|
|
74
70
|
isFetchingEstimatesRef.current = false;
|
|
75
71
|
});
|
|
76
72
|
}, [isDraggingSlider]);
|
|
73
|
+
// Update fetchEstimates ref and re-trigger fetch when the function identity
|
|
74
|
+
// changes (e.g. wallet reconnects → address changes → getQuote recreated →
|
|
75
|
+
// fetchEstimates recreated). We can't just reset lastFetchedKeyRef because
|
|
76
|
+
// ref mutations don't cause the initial-fetch effect to re-run.
|
|
77
|
+
React.useEffect(() => {
|
|
78
|
+
const prev = fetchEstimatesRef.current;
|
|
79
|
+
fetchEstimatesRef.current = fetchEstimates;
|
|
80
|
+
// When fetchEstimates changes and we had already fetched, re-trigger
|
|
81
|
+
if (prev !== fetchEstimates && lastFetchedKeyRef.current) {
|
|
82
|
+
lastFetchedKeyRef.current = null;
|
|
83
|
+
scheduleFetchEstimates(true);
|
|
84
|
+
}
|
|
85
|
+
}, [fetchEstimates, scheduleFetchEstimates]);
|
|
77
86
|
// Recalculate splits from destination amounts
|
|
78
87
|
const recalculateSplitsFromAmounts = useCallback(() => {
|
|
79
88
|
if (!tokenIn)
|
package/dist/hooks/useQuote.js
CHANGED
|
@@ -371,6 +371,13 @@ export function useQuote({ address, maxImpactPercent = X_MAX_IMPACT_PERCENT, for
|
|
|
371
371
|
});
|
|
372
372
|
// Both failed
|
|
373
373
|
if (!relayQuote && !debridgeQuote) {
|
|
374
|
+
// If the signal was aborted, this request was superseded by a newer one.
|
|
375
|
+
// Treat it as an abort (not a real error) so the UI doesn't show an error state.
|
|
376
|
+
if (signal.aborted) {
|
|
377
|
+
console.log('[Quote] All providers returned null because request was aborted');
|
|
378
|
+
const abortError = new DOMException('The operation was aborted.', 'AbortError');
|
|
379
|
+
throw abortError;
|
|
380
|
+
}
|
|
374
381
|
console.error('[Quote] Error: All quote providers failed');
|
|
375
382
|
throw new AggregateError([
|
|
376
383
|
relayResult.status === 'rejected' ? relayResult.reason : null,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silentswap/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.86",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@bigmi/core": "^0.6.5",
|
|
26
26
|
"@ensdomains/ensjs": "^4.2.0",
|
|
27
|
-
"@silentswap/sdk": "0.0.
|
|
28
|
-
"@silentswap/ui-kit": "0.0.
|
|
27
|
+
"@silentswap/sdk": "0.0.86",
|
|
28
|
+
"@silentswap/ui-kit": "0.0.86",
|
|
29
29
|
"@solana/codecs-strings": "^5.1.0",
|
|
30
30
|
"@solana/kit": "^5.1.0",
|
|
31
31
|
"@solana/rpc": "^5.1.0",
|