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:
parent
44bd5e67d1
commit
566b738f91
@ -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}
|
||||||
|
@ -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}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user