mirror of
				https://github.com/gristlabs/grist-core.git
				synced 2025-06-13 20:53:59 +00:00 
			
		
		
		
	(core) Fixing bug on a fresh Choice and ChoiceList column
Summary: Adding a new element to a new Choice or ChoiceList column resulted in javascript error Test Plan: Browser tests Reviewers: georgegevoian, dsagal Reviewed By: georgegevoian, dsagal Subscribers: dsagal Differential Revision: https://phab.getgrist.com/D2932
This commit is contained in:
		
							parent
							
								
									f5981606e1
								
							
						
					
					
						commit
						9cc034f606
					
				@ -80,7 +80,7 @@ ChoiceEditor.prototype.prepForSave = async function() {
 | 
			
		||||
  const selectedItem = this.autocomplete && this.autocomplete.getSelectedItem();
 | 
			
		||||
  if (selectedItem && selectedItem.isNew) {
 | 
			
		||||
    const choices = this.options.field.widgetOptionsJson.prop('choices');
 | 
			
		||||
    await choices.saveOnly([...choices.peek(), selectedItem.label]);
 | 
			
		||||
    await choices.saveOnly([...(choices.peek() || []), selectedItem.label]);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -157,7 +157,7 @@ export class ChoiceListEditor extends NewBaseEditor {
 | 
			
		||||
    const newChoices = tokens.filter(t => t.isNew).map(t => t.label);
 | 
			
		||||
    if (newChoices.length > 0) {
 | 
			
		||||
      const choices = this.options.field.widgetOptionsJson.prop('choices');
 | 
			
		||||
      await choices.saveOnly([...choices.peek(), ...new Set(newChoices)]);
 | 
			
		||||
      await choices.saveOnly([...(choices.peek() || []), ...new Set(newChoices)]);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user