Skip to content

Commit

Permalink
#121 - Fixed updating the initial values
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf committed Dec 6, 2018
1 parent 1ef9788 commit f1ad080
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
],
"fixes": [
"`PropertyFieldCollectionData`: Issue with debounce validation overriding the inserted values [#113](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/113)",
"`PropertyPaneWebPartInformation`: Remove redundant 'Description' label [#119](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/119)"
"`PropertyPaneWebPartInformation`: Remove redundant 'Description' label [#119](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/119)",
"`PropertyFieldCodeEditor`: Handle initial value after updating properties [#121](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/121)"
]
},
"contributions": ["[Erwin van Hunen](https://github.com/erwinvanhunen)"]
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- `PropertyFieldCollectionData`: Issue with debounce validation overriding the inserted values [#113](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/113)
- `PropertyPaneWebPartInformation`: Remove redundant 'Description' label [#119](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/119)
- `PropertyFieldCodeEditor`: Handle initial value after updating properties [#121](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/121)

### Contributors

Expand Down
1 change: 1 addition & 0 deletions docs/documentation/docs/about/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- `PropertyFieldCollectionData`: Issue with debounce validation overriding the inserted values [#113](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/113)
- `PropertyPaneWebPartInformation`: Remove redundant 'Description' label [#119](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/119)
- `PropertyFieldCodeEditor`: Handle initial value after updating properties [#121](https://github.com/SharePoint/sp-dev-fx-property-controls/issues/121)

### Contributors

Expand Down
14 changes: 14 additions & 0 deletions src/propertyFields/codeEditor/PropertyFieldCodeEditorHost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ export default class PropertyFieldCodeEditorHost extends React.Component<IProper
this.async = new Async(this);
}

/**
* componentWillUpdate lifecycle hook
*
* @param nextProps
* @param nextState
*/
public componentWillUpdate(nextProps: IPropertyFieldCodeEditorHostProps, nextState: IPropertyFieldCodeEditorHostState): void {
if (nextProps.initialValue !== this.props.initialValue) {
this.setState({
code: typeof this.props.initialValue !== 'undefined' ? this.props.initialValue : ''
});
}
}

/**
* Open the right Panel
*/
Expand Down

0 comments on commit f1ad080

Please sign in to comment.