Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ gem 'resource_api', git: 'https://github.com/performant-software/resource-api.gi
gem 'jwt_auth', git: 'https://github.com/performant-software/jwt-auth.git', tag: 'v0.1.3'

# Core data
gem 'core_data_connector', git: 'https://github.com/performant-software/core-data-connector.git', tag: 'v0.1.103'
gem 'core_data_connector', git: 'https://github.com/performant-software/core-data-connector.git', tag: 'v0.1.104'

# IIIF
gem 'triple_eye_effable', git: 'https://github.com/performant-software/triple-eye-effable.git', tag: 'v0.2.7'
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GIT
remote: https://github.com/performant-software/core-data-connector.git
revision: e16f738ed177b6a90943d523849839cd109c1dbb
tag: v0.1.103
revision: d4a600c56a42b38cddfcabe74e486ae6e6cb8f30
tag: v0.1.104
specs:
core_data_connector (0.1.0)
activerecord-postgis-adapter (~> 11.0)
Expand Down
23 changes: 22 additions & 1 deletion client/src/components/PlaceForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ const PlaceForm = (props: Props) => {
*/
const [geocoding, setGeocoding] = useState(MapSessionUtils.restoreSession('mapView', localStorage).geocoding);

/**
* Tracks map geometry data independently of props.item
*/
const [mapData, setMapData] = useState(null);

/**
* Updates localStorage to persist geocoding setting across pages.
*/
Expand Down Expand Up @@ -108,12 +113,28 @@ const PlaceForm = (props: Props) => {
return null;
}, []);

/**
* Sets map geometry data on the item, destroying any existing geometry record
* if all geometry is deleted.
*/
useEffect(() => {
if (mapData !== null) {
if (props.item.place_geometry?.id && mapData.geometry_json.features?.length === 0) {
props.onSetState({
place_geometry: { id: props.item.place_geometry.id, _destroy: true }
});
} else {
props.onSetState({ place_geometry: mapData })
}
}
}, [mapData, props.item.place_geometry?.id]);

/**
* Sets the new map geometries on the state.
*
* @type {function(*): *}
*/
const onMapChange = useCallback((data) => props.onSetState({ place_geometry: { geometry_json: data } }), []);
const onMapChange = useCallback((data) => setMapData({ geometry_json: data }), []);

/**
* Sets the uploaded file as the GeoJSON object.
Expand Down