mirror of
				https://github.com/reduxjs/redux-devtools.git
				synced 2025-11-04 09:57:26 +03:00 
			
		
		
		
	Avoid auto selecting instance in iFrame
Avoid auto selecting the outter frame instance when redux exist in iFrame embedded on the page.
This commit is contained in:
		
							parent
							
								
									65126657cb
								
							
						
					
					
						commit
						d03eb599a8
					
				
							
								
								
									
										5
									
								
								.changeset/fluffy-steaks-promise.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								.changeset/fluffy-steaks-promise.md
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
---
 | 
			
		||||
'remotedev-redux-devtools-extension': patch
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Avoid auto-selecting instance with iFrames
 | 
			
		||||
| 
						 | 
				
			
			@ -13,7 +13,16 @@ function selectInstance(
 | 
			
		|||
) {
 | 
			
		||||
  const instances = store.getState().instances;
 | 
			
		||||
  if (instances.current === 'default') return;
 | 
			
		||||
  const connections = instances.connections[tabId];
 | 
			
		||||
 | 
			
		||||
  const connections = Object.entries(instances.connections).reduce<
 | 
			
		||||
    (string | number)[]
 | 
			
		||||
  >((acc, [key, connections]) => {
 | 
			
		||||
    if (key.startsWith(String(tabId))) {
 | 
			
		||||
      return [...acc, ...connections];
 | 
			
		||||
    }
 | 
			
		||||
    return acc;
 | 
			
		||||
  }, []);
 | 
			
		||||
 | 
			
		||||
  if (connections && connections.length === 1) {
 | 
			
		||||
    next({ type: SELECT_INSTANCE, selected: connections[0] });
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user