Skip to content

Commit c671f45

Browse files
feat/AB#80877_add_logic_to_create_edit_load_page_with_geographic_context fix: region and country property switch and save in order to exclude each other
1 parent b46de50 commit c671f45

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

apps/back-office/src/app/dashboard/pages/dashboard/dashboard.component.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,19 @@ export class DashboardComponent
225225
.subscribe((value) => {
226226
// reset country code as it's not possible to have country and region selected
227227
this.countryCode.setValue(value, { emitEvent: false });
228+
// In case we switch from country to region
229+
// remove previous geographic context country property inside the dashboard object
230+
delete this.dashboard?.page?.geographicContext?.country;
228231
this.onContextChange(value, 'geographic');
229232
});
230233
this.countryCode.valueChanges
231234
.pipe(takeUntil(this.destroy$))
232235
.subscribe((value) => {
233236
// reset region code as it's not possible to have country and region selected
234237
this.regionCode.setValue(value, { emitEvent: false });
238+
// In case we switch from region to country
239+
// remove previous geographic context region property inside the dashboard object
240+
delete this.dashboard?.page?.geographicContext?.region;
235241
this.onContextChange(value, 'geographic');
236242
});
237243
}
@@ -965,9 +971,6 @@ export class DashboardComponent
965971
value: string | string[],
966972
geographicType: 'region' | 'country'
967973
): void {
968-
// In case we switch from region to country
969-
// remove previous geographic context property inside the dashboard object
970-
delete this.dashboard?.page?.geographicContext;
971974
const geographicContext: PageGeographicContextType = {
972975
enabled: true,
973976
...(value && { [geographicType]: value }),

0 commit comments

Comments
 (0)