diff --git a/lib/session-helpers.ts b/lib/session-helpers.ts index 8bc2112..bbe0b0d 100644 --- a/lib/session-helpers.ts +++ b/lib/session-helpers.ts @@ -114,10 +114,9 @@ export function withPageAuthRequired( }; } - const getServerSidePropsResult = await getServerSideProps( - context, - user, - ); + const start = Date.now(); + const getServerSidePropsResult = await getServerSideProps(context, user); + console.log("getServerSideProps took", Date.now() - start); if (!hasProps(getServerSidePropsResult)) { return getServerSidePropsResult; } diff --git a/src/pages/keypad.tsx b/src/pages/keypad.tsx index 4c8e2e8..4da0249 100644 --- a/src/pages/keypad.tsx +++ b/src/pages/keypad.tsx @@ -65,7 +65,7 @@ const Keypad: NextPage = () => { const ZeroDigit: FunctionComponent = () => { return ( -
+
0 +
); @@ -117,12 +117,6 @@ const pressBackspaceAtom = atom( }, ); -export const getServerSideProps = withPageOnboardingRequired( - async (context, user) => { - return { - props: { userId: user.id, ddd: 23 as const }, - }; - }, -); +export const getServerSideProps = withPageOnboardingRequired(); export default Keypad; diff --git a/src/pages/messages/index.tsx b/src/pages/messages/index.tsx index 6cd703a..1c8da4d 100644 --- a/src/pages/messages/index.tsx +++ b/src/pages/messages/index.tsx @@ -46,12 +46,13 @@ const Messages: NextPage = ({ conversations }) => { }; type Recipient = string; -export type Conversation = Record; export const getServerSideProps = withPageOnboardingRequired( async (context, user) => { - const customer = await findCustomer(user.id); - const messages = await findCustomerMessages(user.id); + const [customer, messages] = await Promise.all([ + findCustomer(user.id), + findCustomerMessages(user.id), + ]); let conversations: Record = {}; for (const message of messages) {