Skip to content

Commit

Permalink
Merge pull request #654 from GetStream/fix-server-side-rendering
Browse files Browse the repository at this point in the history
fix: server-side rendering compatibility
  • Loading branch information
szuperaz authored Oct 10, 2024
2 parents 5f2631b + def7070 commit b494be3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 2 additions & 3 deletions projects/stream-chat-angular/src/lib/is-safari.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export const isSafari = /^((?!chrome|android).)*safari/i.test(
navigator.userAgent
);
export const isSafari = () =>
/^((?!chrome|android).)*safari/i.test(navigator.userAgent);
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export class MessageListComponent
private forceRepaintSubject = new Subject<void>();
private messageIdToAnchorTo?: string;
private anchorMessageTopOffset?: number;
private isSafari = isSafari();

@HostBinding('class')
private get class() {
Expand Down Expand Up @@ -468,7 +469,7 @@ export class MessageListComponent
scrollToBottom(): void {
this.scrollContainer.nativeElement.scrollTop =
this.scrollContainer.nativeElement.scrollHeight + 0.1;
if (isSafari) {
if (this.isSafari) {
this.forceRepaintSubject.next();
}
}
Expand Down Expand Up @@ -609,7 +610,7 @@ export class MessageListComponent
(messageToAlignTo?.getBoundingClientRect()?.top || 0) -
(this.anchorMessageTopOffset || 0);
this.anchorMessageTopOffset = undefined;
if (isSafari) {
if (this.isSafari) {
this.forceRepaintSubject.next();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class AudioRecorderService extends MultimediaRecorder<
* - For all other browsers we use audio/webm (which is then transcoded to wav)
*/
config: MediaRecorderConfig = {
mimeType: isSafari ? 'audio/mp4;codecs=mp4a.40.2' : 'audio/webm',
mimeType: isSafari() ? 'audio/mp4;codecs=mp4a.40.2' : 'audio/webm',
};

constructor(
Expand Down

0 comments on commit b494be3

Please sign in to comment.