File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -213,15 +213,7 @@ const editRegion = form.params<{ region: Region; displayName: boolean }>(
213213 noI18n `Заменить зону` ,
214214 selectArea ( {
215215 title : noI18n `Заменить зону` ,
216- onSelect : area => {
217- // Area changed, need to update chunk query storages too
218- Region . chunkQuery . remove ( region )
219- region . area = area
220- region . save ( )
221- Region . chunkQuery . add ( region )
222-
223- return self
224- } ,
216+ onSelect : area => ( region . replaceArea ( area ) , self ) ,
225217 } ) ,
226218 )
227219
Original file line number Diff line number Diff line change @@ -211,11 +211,19 @@ export class Region {
211211 * @param o.key - The key of the region. This is used to identify the region.
212212 */
213213 constructor (
214- public area : Area ,
214+ readonly area : Area ,
215215 options : RegionCreationOptions ,
216216 readonly id : string ,
217217 ) { }
218218
219+ public replaceArea ( newArea : Area ) {
220+ // Area changed, need to update chunk query storages too
221+ Region . chunkQuery . remove ( this )
222+ ; ( this as { area : Area } ) . area = newArea
223+ this . save ( )
224+ Region . chunkQuery . add ( this )
225+ }
226+
219227 /** Function that gets called on region creation after saving (once) */
220228 protected onCreate ( ) {
221229 // Hook
You can’t perform that action at this time.
0 commit comments