Fix building edit details on props change

- EditForm owns form state
- fully uncontrolled component
- when props change (e.g. when clicking on another building) the
  component should completely re-render
This commit is contained in:
Tom Russell 2019-08-14 14:10:52 +01:00
parent 44bd5e67d1
commit 566b738f91
2 changed files with 1 additions and 2 deletions

View File

@ -32,6 +32,7 @@ const BuildingEdit = (props) => {
return (
<Sidebar>
<EditForm
key={props.building_id} // provide key so that React re-creates if props change
{...section}
{...props}
cat={cat}

View File

@ -29,9 +29,7 @@ const BuildingView = (props) => {
return (
<Sidebar>
<DataSection
key={section.slug}
cat={cat}
building_id={props.building_id}
{...section}
{...props}
/>