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 ( return (
<Sidebar> <Sidebar>
<EditForm <EditForm
key={props.building_id} // provide key so that React re-creates if props change
{...section} {...section}
{...props} {...props}
cat={cat} cat={cat}

View File

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