@dynamic-labs/sdk-react-core 4.46.2 → 4.46.3

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
@@ -1,4 +1,11 @@
1
1
 
2
+ ### [4.46.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.46.2...v4.46.3) (2025-11-20)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * ensure that phantomredirect does not render if the previous request is the same ([#9920](https://github.com/dynamic-labs/dynamic-auth/issues/9920)) ([2bb9665](https://github.com/dynamic-labs/dynamic-auth/commit/2bb96654821518bee6378c65d1353a33aea1363b))
8
+
2
9
  ### [4.46.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.46.1...v4.46.2) (2025-11-20)
3
10
 
4
11
 
package/package.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.46.2";
6
+ var version = "4.46.3";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.821",
9
9
  "@dynamic-labs-sdk/client": "0.1.0-alpha.28",
package/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- var version = "4.46.2";
2
+ var version = "4.46.3";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.821",
5
5
  "@dynamic-labs-sdk/client": "0.1.0-alpha.28",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "4.46.2",
3
+ "version": "4.46.3",
4
4
  "dependencies": {
5
5
  "@dynamic-labs/sdk-api-core": "0.0.821",
6
6
  "@dynamic-labs-sdk/client": "0.1.0-alpha.28",
@@ -15,17 +15,17 @@
15
15
  "yup": "0.32.11",
16
16
  "react-international-phone": "4.5.0",
17
17
  "bs58": "5.0.0",
18
- "@dynamic-labs/assert-package-version": "4.46.2",
19
- "@dynamic-labs/iconic": "4.46.2",
20
- "@dynamic-labs/locale": "4.46.2",
21
- "@dynamic-labs/logger": "4.46.2",
22
- "@dynamic-labs/multi-wallet": "4.46.2",
23
- "@dynamic-labs/rpc-providers": "4.46.2",
24
- "@dynamic-labs/store": "4.46.2",
25
- "@dynamic-labs/types": "4.46.2",
26
- "@dynamic-labs/utils": "4.46.2",
27
- "@dynamic-labs/wallet-book": "4.46.2",
28
- "@dynamic-labs/wallet-connector-core": "4.46.2",
18
+ "@dynamic-labs/assert-package-version": "4.46.3",
19
+ "@dynamic-labs/iconic": "4.46.3",
20
+ "@dynamic-labs/locale": "4.46.3",
21
+ "@dynamic-labs/logger": "4.46.3",
22
+ "@dynamic-labs/multi-wallet": "4.46.3",
23
+ "@dynamic-labs/rpc-providers": "4.46.3",
24
+ "@dynamic-labs/store": "4.46.3",
25
+ "@dynamic-labs/types": "4.46.3",
26
+ "@dynamic-labs/utils": "4.46.3",
27
+ "@dynamic-labs/wallet-book": "4.46.3",
28
+ "@dynamic-labs/wallet-connector-core": "4.46.3",
29
29
  "eventemitter3": "5.0.1"
30
30
  },
31
31
  "devDependencies": {
@@ -107,11 +107,33 @@ const PhantomRedirectContext = React.createContext(undefined);
107
107
  const PhantomRedirectContextProvider = ({ children, }) => {
108
108
  const { sdkHasLoaded } = useInternalDynamicContext.useInternalDynamicContext();
109
109
  const { phantomRedirectConnector, handleConnectResponse, handleUserResponse, handleErrorResponse, } = useResponseHandlers.useResponseHandlers();
110
+ // Track the last processed redirect params to prevent infinite loops
111
+ // when useEffect re-runs due to callback dependency changes
112
+ const lastProcessedParamsRef = React.useRef('');
110
113
  React.useEffect(() => {
111
114
  if (!phantomRedirectConnector || !utils.isMobile() || !sdkHasLoaded) {
112
115
  return;
113
116
  }
114
117
  const params = utils.PlatformService.getUrl().searchParams;
118
+ // Create a unique key from the relevant params to track if we've already processed this redirect
119
+ const paramsKey = [
120
+ params.get('errorCode'),
121
+ params.get('phantom_encryption_public_key'),
122
+ params.get('data'),
123
+ params.get('nonce'),
124
+ ]
125
+ .filter(Boolean)
126
+ .join('|');
127
+ // If we've already processed these exact params, skip to prevent infinite loop
128
+ // This prevents the useEffect from processing the same redirect multiple times
129
+ // when callback dependencies change and cause the effect to re-run
130
+ if (paramsKey && paramsKey === lastProcessedParamsRef.current) {
131
+ return;
132
+ }
133
+ // Update the ref before processing to mark these params as processed
134
+ if (paramsKey) {
135
+ lastProcessedParamsRef.current = paramsKey;
136
+ }
115
137
  if (params.has('errorCode')) {
116
138
  handleErrorResponse(params);
117
139
  return;
@@ -1,6 +1,6 @@
1
1
  'use client'
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import { createContext, useEffect } from 'react';
3
+ import { createContext, useRef, useEffect } from 'react';
4
4
  import { isMobile, PlatformService } from '@dynamic-labs/utils';
5
5
  import '../DynamicContext/DynamicContext.js';
6
6
  import '../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
@@ -103,11 +103,33 @@ const PhantomRedirectContext = createContext(undefined);
103
103
  const PhantomRedirectContextProvider = ({ children, }) => {
104
104
  const { sdkHasLoaded } = useInternalDynamicContext();
105
105
  const { phantomRedirectConnector, handleConnectResponse, handleUserResponse, handleErrorResponse, } = useResponseHandlers();
106
+ // Track the last processed redirect params to prevent infinite loops
107
+ // when useEffect re-runs due to callback dependency changes
108
+ const lastProcessedParamsRef = useRef('');
106
109
  useEffect(() => {
107
110
  if (!phantomRedirectConnector || !isMobile() || !sdkHasLoaded) {
108
111
  return;
109
112
  }
110
113
  const params = PlatformService.getUrl().searchParams;
114
+ // Create a unique key from the relevant params to track if we've already processed this redirect
115
+ const paramsKey = [
116
+ params.get('errorCode'),
117
+ params.get('phantom_encryption_public_key'),
118
+ params.get('data'),
119
+ params.get('nonce'),
120
+ ]
121
+ .filter(Boolean)
122
+ .join('|');
123
+ // If we've already processed these exact params, skip to prevent infinite loop
124
+ // This prevents the useEffect from processing the same redirect multiple times
125
+ // when callback dependencies change and cause the effect to re-run
126
+ if (paramsKey && paramsKey === lastProcessedParamsRef.current) {
127
+ return;
128
+ }
129
+ // Update the ref before processing to mark these params as processed
130
+ if (paramsKey) {
131
+ lastProcessedParamsRef.current = paramsKey;
132
+ }
111
133
  if (params.has('errorCode')) {
112
134
  handleErrorResponse(params);
113
135
  return;