Scheduling infrastructure for absolutely everyone.
[Perf Improvement] Booking Page score should be in green now (#2057)
Hariom Balharace0c8347fb12
diff --git a/apps/web/components/ui/AvatarSSR.tsx b/apps/web/components/ui/AvatarSSR.tsxindex 1516d51de39..ec2e32d6cd7 100644--- a/apps/web/components/ui/AvatarSSR.tsx+++ b/apps/web/components/ui/AvatarSSR.tsx@@ -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 missingexport function AvatarSSR(props: AvatarProps) {diff --git a/apps/web/pages/[user].tsx b/apps/web/pages/[user].tsxindex 44cbd1256d0..c012fb31ae4 100644--- a/apps/web/pages/[user].tsx+++ b/apps/web/pages/[user].tsx@@ -1,6 +1,5 @@import { ArrowRightIcon } from "@heroicons/react/outline";import { BadgeCheckIcon } from "@heroicons/react/solid";-import crypto from "crypto";import { GetServerSidePropsContext } from "next";import dynamic from "next/dynamic";import Link from "next/link";@@ -66,7 +65,9 @@ export default function User(props: inferSSRProps<typeof getServerSideProps>) {style={{ display: "flex" }}className="group hover:border-brand relative rounded-sm border border-neutral-200 bg-white hover:bg-gray-50 dark:border-0 dark:bg-neutral-900 dark:hover:border-neutral-600"><ArrowRightIcon className="absolute right-3 top-3 h-4 w-4 text-black opacity-0 transition-opacity group-hover:opacity-100 dark:text-white" />+ {/* Don't prefetch till the time we drop the amount of javascript in [user][type] page which is impacting score for [user] page */}<Link+ prefetch={false}href={{pathname: `/${user.username}/${type.slug}`,query,@@ -121,6 +122,7 @@ export default function User(props: inferSSRProps<typeof getServerSideProps>) {export const getServerSideProps = async (context: GetServerSidePropsContext) => {const ssr = await ssrInit(context);+ const crypto = require("crypto");const username = (context.query.user as string).toLowerCase();const dataFetchStart = Date.now();