@silentswap/react 0.0.84 → 0.0.85

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@silentswap/react",
3
3
  "type": "module",
4
- "version": "0.0.84",
4
+ "version": "0.0.85",
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.84",
28
- "@silentswap/ui-kit": "0.0.84",
27
+ "@silentswap/sdk": "0.0.85",
28
+ "@silentswap/ui-kit": "0.0.85",
29
29
  "@solana/codecs-strings": "^5.1.0",
30
30
  "@solana/kit": "^5.1.0",
31
31
  "@solana/rpc": "^5.1.0",