Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[angular] Avoid double requests to dictionary service #1473

Merged
merged 2 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Our versioning strategy is as follows:
* `[angular]` Fix app build errors. Webpack version is locked at 5.78 due to https://github.com/webpack/webpack/issues/16981 ([#1448](https://github.com/Sitecore/jss/pull/1448))
* `[sitecore-jss-nextjs]` Fix middleware redirect when the target use regexp with querystring ([#1449](https://github.com/Sitecore/jss/pull/1449)) ([#1460](https://github.com/Sitecore/jss/pull/1460))
* `[templates/nextjs]` Fix incorrectly named .gitignore file `\scripts\temp\.npmignore` ([#1463](https://github.com/Sitecore/jss/pull/1463))
* `[angular]` Avoid sending two dictionary service calls when switching language and refreshing the page ([#1473](https://github.com/Sitecore/jss/pull/1473))

## 21.1.1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Component, OnDestroy } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { JssContextService } from './jss-context.service';
import { environment as env } from '../environments/environment';
import { Subscription } from 'rxjs';

@Component({
Expand All @@ -15,12 +14,6 @@ export class AppComponent implements OnDestroy {
translate: TranslateService,
jssContextService: JssContextService,
) {
// this language will be used as a fallback when a translation isn't found in the current language
translate.setDefaultLang(env.defaultLanguage);

// the lang to use. if the lang isn't available, it will use the current loader to get them
translate.use(env.defaultLanguage);

this.contextSubscription = jssContextService.state.subscribe(jssState => {
// listen for language changes
if (jssState.language) {
Expand Down