Skip to content

Commit

Permalink
fix: fixed mapbox fields marked issue
Browse files Browse the repository at this point in the history
- fixed issue where mapbox fields were not marked as touched or dirty on map changes, causing dbxActionForm to not register the changes
  • Loading branch information
dereekb committed Dec 10, 2022
1 parent 4a8190e commit 04e6e3a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/dbx-core/src/lib/action/action.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ export class ActionContextStore<T = unknown, O = unknown> extends ComponentStore

afterDistinctLoadingStateTypeChange(): Observable<ActionContextState<T, O>> {
return this.state$.pipe(
map((x) => [x, loadingStateForActionContextState(x)] as [ActionContextState, LoadingStateType]),
map((x) => [x, loadingStateTypeForActionContextState(x)] as [ActionContextState, LoadingStateType]),
distinctUntilChanged((a, b) => a?.[1] === b?.[1]), // Filter out when the loading state remains the same.
map((x) => x[0] as ActionContextState<T, O>),
shareReplay(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ export class DbxFormMapboxLatLngFieldComponent<T extends DbxFormMapboxLatLngComp
this._sub.subscription = this.dbxMapboxMapStore.center$.subscribe((center) => {
this.dbxMapboxMapStore.centerGivenMargin$.pipe(first()).subscribe(() => {
if (!this.isReadonlyOrDisabled) {
this.ngZone.run(() => this.setValue(center));
this.ngZone.run(() => {
this.setValue(center);
});
}
});
});
Expand Down Expand Up @@ -189,5 +191,7 @@ export class DbxFormMapboxLatLngFieldComponent<T extends DbxFormMapboxLatLngComp

setValue(latLng?: Maybe<LatLngPoint>) {
this.formControl.setValue(latLng ? this._latLngStringFunction(latLng) : latLng);
this.formControl.markAsTouched();
this.formControl.markAsDirty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,7 @@ export class DbxFormMapboxZoomFieldComponent<T extends DbxFormMapboxZoomComponen

setValue(zoom?: Maybe<ZoomLevel>) {
this.formControl.setValue(zoom);
this.formControl.markAsTouched();
this.formControl.markAsDirty();
}
}

0 comments on commit 04e6e3a

Please sign in to comment.