@@ -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