Skip to content

Commit 7c7aadb

Browse files
committed
update translation tree
1 parent 742cce5 commit 7c7aadb

1 file changed

Lines changed: 17 additions & 16 deletions

File tree

src/app/features/spaces/translations/translations.component.ts

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ export class TranslationsComponent implements OnInit {
147147
// Subscriptions
148148
history$?: Observable<TranslationHistory[]>;
149149
space$?: Observable<Space>;
150-
translations$?: Observable<Translation[]>;
151150

152151
//Loadings
153152
isLoading = signal(true);
@@ -198,25 +197,27 @@ export class TranslationsComponent implements OnInit {
198197
}),
199198
takeUntilDestroyed(this.destroyRef),
200199
);
201-
this.translations$ = this.translationService.findAll(this.spaceId()).pipe(
202-
tap(translations => {
203-
this.translations.set(translations);
204-
if (translations.length > 0) {
205-
if (this.selectedTranslation) {
206-
const tr = translations.find(it => it.id === this.selectedTranslation?.id);
207-
if (tr) {
208-
this.selectTranslation(tr);
200+
this.translationService
201+
.findAll(this.spaceId())
202+
.pipe(takeUntilDestroyed(this.destroyRef))
203+
.subscribe({
204+
next: translations => {
205+
this.translations.set(translations);
206+
if (translations.length > 0) {
207+
if (this.selectedTranslation) {
208+
const tr = translations.find(it => it.id === this.selectedTranslation?.id);
209+
if (tr) {
210+
this.selectTranslation(tr);
211+
} else {
212+
this.selectTranslation(translations[0]);
213+
}
209214
} else {
210215
this.selectTranslation(translations[0]);
211216
}
212-
} else {
213-
this.selectTranslation(translations[0]);
214217
}
215-
}
216-
this.isLoading.set(false);
217-
}),
218-
takeUntilDestroyed(this.destroyRef),
219-
);
218+
this.isLoading.set(false);
219+
},
220+
});
220221
this.history$ = this.translateHistoryService.findAll(this.spaceId()).pipe(takeUntilDestroyed(this.destroyRef));
221222
}
222223

0 commit comments

Comments
 (0)