Skip to content

Commit 524e134

Browse files
authored
Merge pull request #511 from performant-software/develop
Develop into master
2 parents 827a0d4 + 60f70e8 commit 524e134

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ gem 'resource_api', git: 'https://github.com/performant-software/resource-api.gi
3737
gem 'jwt_auth', git: 'https://github.com/performant-software/jwt-auth.git', tag: 'v0.1.3'
3838

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

4242
# IIIF
4343
gem 'triple_eye_effable', git: 'https://github.com/performant-software/triple-eye-effable.git', tag: 'v0.2.7'

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GIT
22
remote: https://github.com/performant-software/core-data-connector.git
3-
revision: e16f738ed177b6a90943d523849839cd109c1dbb
4-
tag: v0.1.103
3+
revision: d4a600c56a42b38cddfcabe74e486ae6e6cb8f30
4+
tag: v0.1.104
55
specs:
66
core_data_connector (0.1.0)
77
activerecord-postgis-adapter (~> 11.0)

client/src/components/PlaceForm.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ const PlaceForm = (props: Props) => {
4949
*/
5050
const [geocoding, setGeocoding] = useState(MapSessionUtils.restoreSession('mapView', localStorage).geocoding);
5151

52+
/**
53+
* Tracks map geometry data independently of props.item
54+
*/
55+
const [mapData, setMapData] = useState(null);
56+
5257
/**
5358
* Updates localStorage to persist geocoding setting across pages.
5459
*/
@@ -108,12 +113,28 @@ const PlaceForm = (props: Props) => {
108113
return null;
109114
}, []);
110115

116+
/**
117+
* Sets map geometry data on the item, destroying any existing geometry record
118+
* if all geometry is deleted.
119+
*/
120+
useEffect(() => {
121+
if (mapData !== null) {
122+
if (props.item.place_geometry?.id && mapData.geometry_json.features?.length === 0) {
123+
props.onSetState({
124+
place_geometry: { id: props.item.place_geometry.id, _destroy: true }
125+
});
126+
} else {
127+
props.onSetState({ place_geometry: mapData })
128+
}
129+
}
130+
}, [mapData, props.item.place_geometry?.id]);
131+
111132
/**
112133
* Sets the new map geometries on the state.
113134
*
114135
* @type {function(*): *}
115136
*/
116-
const onMapChange = useCallback((data) => props.onSetState({ place_geometry: { geometry_json: data } }), []);
137+
const onMapChange = useCallback((data) => setMapData({ geometry_json: data }), []);
117138

118139
/**
119140
* Sets the uploaded file as the GeoJSON object.

0 commit comments

Comments
 (0)