diff --git a/samples/react-property-bag-editor/src/webparts/propertyBagEditor/components/PropertyBagEditor.tsx b/samples/react-property-bag-editor/src/webparts/propertyBagEditor/components/PropertyBagEditor.tsx index 3b58e2091..e3d94d391 100644 --- a/samples/react-property-bag-editor/src/webparts/propertyBagEditor/components/PropertyBagEditor.tsx +++ b/samples/react-property-bag-editor/src/webparts/propertyBagEditor/components/PropertyBagEditor.tsx @@ -106,9 +106,13 @@ export default class PropertyBagEditor extends React.Component ({ ...current, workingStorage: ({ ...current.workingStorage, searchable: newValue }) })); } /** * Gets fired when the user changes the proprty value in the ui @@ -119,8 +123,16 @@ export default class PropertyBagEditor extends React.Component ({ + ...current, + workingStorage: ({ + ...current.workingStorage, + value: event.target.value + }) + } + )); } /** @@ -149,11 +161,11 @@ export default class PropertyBagEditor extends React.Component { this.changeSearchable(this.state.workingStorage.crawledPropertyName, this.state.workingStorage.searchable) .then(s => { - this.state.displayProps[this.state.selectedIndex] = this.state.workingStorage; - // this.state.workingStorage = null; - // this.state.isediting = false; + //this.state.displayProps[this.state.selectedIndex] = this.state.workingStorage; + const temp = _.clone(this.state.displayProps);// this.state.workingStorage = null; + temp[this.state.selectedIndex] = this.state.workingStorage;// this.state.isediting = false; // this.setState(this.state); - this.setState((current) => ({ ...current, isediting: false, workingStorage: null })) + this.setState((current) => ({ ...current, isediting: false, workingStorage: null, displayProps: temp })) }); }); } @@ -184,8 +196,11 @@ export default class PropertyBagEditor extends React.Component { if (newValue) {//make prop searchable if (_.indexOf(this.state.searchableProps, propname) === -1) {// wasa not searchable, mpw it is - this.state.searchableProps.push(propname); - return utils.saveSearchablePropertiesToSharePoint(this.props.siteUrl, this.state.searchableProps); + //this.state.searchableProps.push(propname); + const temp = _.clone(this.state.searchableProps); + temp.push(propname); + this.setState(current => ({ ...current, searchableProps: temp })); + return utils.saveSearchablePropertiesToSharePoint(this.props.siteUrl, temp); } else { return Promise.resolve(); @@ -193,8 +208,11 @@ export default class PropertyBagEditor extends React.Component { return p === propname; }); - return utils.saveSearchablePropertiesToSharePoint(this.props.siteUrl, this.state.searchableProps); + const temp = _.clone(this.state.searchableProps); + + _.remove(temp, p => { return p === propname; }); + this.setState(current => ({ ...current, searchableProps: temp })); + return utils.saveSearchablePropertiesToSharePoint(this.props.siteUrl, temp); } else { return Promise.resolve(); @@ -221,7 +239,7 @@ export default class PropertyBagEditor extends React.Component @@ -234,7 +252,7 @@ export default class PropertyBagEditor extends React.Component