Skip to content

Commit 4e33254

Browse files
committed
fix: application style would not be applied before load
1 parent 222d67c commit 4e33254

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

libs/safe/src/lib/services/application/application.service.ts

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,23 +1916,27 @@ export class SafeApplicationService {
19161916
const styleFromFile = await res.text();
19171917
const scss = styleFromFile as string;
19181918
this.customStyle = document.createElement('style');
1919-
this.restService
1920-
.post('style/scss-to-css', { scss }, { responseType: 'text' })
1921-
.subscribe({
1922-
next: (css) => {
1923-
if (this.customStyle) {
1924-
this.customStyle.innerText = css;
1925-
document
1926-
.getElementsByTagName('head')[0]
1927-
.appendChild(this.customStyle);
1928-
}
1929-
},
1930-
error: () => {
1931-
if (this.customStyle) {
1932-
this.customStyle.innerText = styleFromFile;
1933-
}
1934-
},
1919+
await firstValueFrom(
1920+
this.restService.post(
1921+
'style/scss-to-css',
1922+
{ scss },
1923+
{ responseType: 'text' }
1924+
)
1925+
)
1926+
.then((css) => {
1927+
if (this.customStyle) {
1928+
this.customStyle.innerText = css;
1929+
document
1930+
.getElementsByTagName('head')[0]
1931+
.appendChild(this.customStyle);
1932+
}
1933+
})
1934+
.catch(() => {
1935+
if (this.customStyle) {
1936+
this.customStyle.innerText = styleFromFile;
1937+
}
19351938
});
1939+
19361940
this.rawCustomStyle = styleFromFile;
19371941
}
19381942
})

0 commit comments

Comments
 (0)