mirror of
				https://github.com/strapi/strapi.git
				synced 2025-11-04 03:43:34 +00:00 
			
		
		
		
	Update check namespace unique condition
This commit is contained in:
		
							parent
							
								
									4375b1c59f
								
							
						
					
					
						commit
						fec7800e42
					
				@ -20,7 +20,8 @@ class CustomFields {
 | 
				
			|||||||
    const namespace = pluginId ? `plugin::${pluginId}.${name}` : `global::global.${name}`;
 | 
					    const namespace = pluginId ? `plugin::${pluginId}.${name}` : `global::global.${name}`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Ensure the namespace is unique
 | 
					    // Ensure the namespace is unique
 | 
				
			||||||
    invariant(this.customFields[namespace] === undefined, 'A similar custom field already exists');
 | 
					    const namespaceAlreadyUsed = Object.prototype.hasOwnProperty.call(this.customFields, namespace);
 | 
				
			||||||
 | 
					    invariant(!namespaceAlreadyUsed, 'A similar custom field already exists');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.customFields[namespace] = customField;
 | 
					    this.customFields[namespace] = customField;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user