Clear all state fields on select change
This commit is contained in:
parent
b81d49df43
commit
f189ae603e
@ -81,10 +81,14 @@ const withCopyEdit = (WrappedComponent) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static getDerivedStateFromProps(props, state) {
|
static getDerivedStateFromProps(props, state) {
|
||||||
if(props.building != undefined && props.building.building_id !== state.currentBuildingId) {
|
const newBuildingId = props.building == undefined ? undefined : props.building.building_id;
|
||||||
|
if(newBuildingId !== state.currentBuildingId) {
|
||||||
return {
|
return {
|
||||||
|
error: undefined,
|
||||||
|
copying: false,
|
||||||
|
keys_to_copy: {},
|
||||||
buildingEdits: {},
|
buildingEdits: {},
|
||||||
currentBuildingId: props.building.building_id
|
currentBuildingId: newBuildingId
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user