[Perf Improvement] Booking Page score should be in green now (#2057)

* Avoid crypto to land in the browser

* Avoid prefetching as it has Crypto code bundled in AvatarGroup

* Use md5 directly if avatar not available

Co-authored-by: Bailey Pumfleet <[email protected]>
This commit is contained in:
Hariom BalharaandBailey Pumfleet authored and GitHub committed 2022-03-05 15:28:24 +00:00
1 parent 91b732ff1c
commit ce0c8347fb
2 files changed
+8 -2

No files matched your search

+5 -1
View File
@@ -1,7 +1,6 @@
import { User } from "@prisma/client";
import classNames from "@lib/classNames";
import { defaultAvatarSrc } from "@lib/profile";
export type AvatarProps = {
user: Pick<User, "name" | "username" | "avatar"> & { emailMd5?: string };
@@ -11,6 +10,11 @@ export type AvatarProps = {
alt: string;
};
// defaultAvatarSrc from profile.tsx can't be used as it imports crypto
function defaultAvatarSrc({ md5 }) {
return `https://www.gravatar.com/avatar/${md5}?s=160&d=identicon&r=PG`;
}
// An SSR Supported version of Avatar component.
// FIXME: title support is missing
export function AvatarSSR(props: AvatarProps) {