time GSSP

This commit is contained in:
m5r 2021-07-21 11:29:29 +08:00
parent 6a12d0cd93
commit 067d0d97c4
3 changed files with 9 additions and 15 deletions

View File

@ -114,10 +114,9 @@ export function withPageAuthRequired<Props extends EmptyProps = EmptyProps>(
}; };
} }
const getServerSidePropsResult = await getServerSideProps( const start = Date.now();
context, const getServerSidePropsResult = await getServerSideProps(context, user);
user, console.log("getServerSideProps took", Date.now() - start);
);
if (!hasProps(getServerSidePropsResult)) { if (!hasProps(getServerSidePropsResult)) {
return getServerSidePropsResult; return getServerSidePropsResult;
} }

View File

@ -65,7 +65,7 @@ const Keypad: NextPage<Props> = () => {
const ZeroDigit: FunctionComponent = () => { const ZeroDigit: FunctionComponent = () => {
return ( return (
<div className="text-3xl cursor-pointer"> <div className="text-3xl cursor-pointer select-none">
0 <DigitLetters>+</DigitLetters> 0 <DigitLetters>+</DigitLetters>
</div> </div>
); );
@ -117,12 +117,6 @@ const pressBackspaceAtom = atom(
}, },
); );
export const getServerSideProps = withPageOnboardingRequired( export const getServerSideProps = withPageOnboardingRequired();
async (context, user) => {
return {
props: { userId: user.id, ddd: 23 as const },
};
},
);
export default Keypad; export default Keypad;

View File

@ -46,12 +46,13 @@ const Messages: NextPage<Props> = ({ conversations }) => {
}; };
type Recipient = string; type Recipient = string;
export type Conversation = Record<Recipient, Sms[]>;
export const getServerSideProps = withPageOnboardingRequired( export const getServerSideProps = withPageOnboardingRequired(
async (context, user) => { async (context, user) => {
const customer = await findCustomer(user.id); const [customer, messages] = await Promise.all([
const messages = await findCustomerMessages(user.id); findCustomer(user.id),
findCustomerMessages(user.id),
]);
let conversations: Record<Recipient, Sms> = {}; let conversations: Record<Recipient, Sms> = {};
for (const message of messages) { for (const message of messages) {