Skip to content

Commit

Permalink
#25901 Unable to reuse content inside the variants (#26658)
Browse files Browse the repository at this point in the history
* fix language change

* make solutions consistent across environments
  • Loading branch information
hmoreras authored Nov 13, 2023
1 parent 2c13f3c commit d856431
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@
*ngIf="(isEnterpriseLicense$ | async) && isEditMode && allowedContent"
[class.collapsed]="paletteCollapsed"
[class.editMode]="isEditMode">
<dot-palette
[allowedContent]="allowedContent"
[languageId]="pageStateInternal.page?.languageId">
<dot-palette [allowedContent]="allowedContent" [languageId]="pageLanguageId">
</dot-palette>
<div
class="dot-edit-content__palette-visibility"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ describe('DotEditContentComponent', () => {
mode: DotPageMode.PREVIEW
}
},
data: of({})
data: of({}),
queryParams: of({ language_id: '1' })
}
},
{ provide: DotMessageDisplayService, useClass: DotMessageDisplayServiceMock },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export class DotEditContentComponent implements OnInit, OnDestroy {
featureFlagSeo = FeaturedFlags.FEATURE_FLAG_SEO_IMPROVEMENTS;
seoOGTags: SeoMetaTags;
seoOGTagsResults = null;
pageLanguageId: string;

private readonly customEventsHandler;
private destroy$: Subject<boolean> = new Subject<boolean>();
Expand Down Expand Up @@ -184,6 +185,7 @@ browse from the page internal links
this.subscribeOverlayService();
this.subscribeDraggedContentType();
this.getExperimentResolverData();
this.subscribeToLanguageChange();

/*This is needed when the user is in the edit mode in an experiment variant
and navigate to another page with the page menu and want to go back with the
Expand Down Expand Up @@ -663,4 +665,14 @@ browse from the page internal links
})
);
}

/**
* Subscribe to language change, because pageState.page.languageId is not being updated
* as should be between dev environments.
*/
private subscribeToLanguageChange(): void {
this.route.queryParams.pipe(takeUntil(this.destroy$)).subscribe((params) => {
this.pageLanguageId = params['language_id'];
});
}
}

0 comments on commit d856431

Please sign in to comment.