* chore * chore * feat: paginated event types * fix: event types page * fix: k bar * fix: event type order * fix: type error * chore: remove commented code * chore: type err * chore: type err and feedback * feat: add old component * chore: missing import * fix: add isInfiniteScrollEnabled prop * chore: type err * chore: type error * feat: auto fetch next page when button is in view * Update packages/lib/server/repository/eventType.ts * Update packages/lib/server/repository/eventType.ts * chore: feedback * fix: managed event types * fix: Review fixes for event-types-infinite-scroll (#16047) * Review fixes * chore: missing import --------- Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: Udit Takkar <udit222001@gmail.com> * chore: type error * chore * fix: delete event type * fix: create event dialog * fix: create and duplicate dialog * chore: simplify return type * fix: type * chore: invalidate query * chore: remove query * fix duplicated event not showing. --------- Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
29 lines
891 B
TypeScript
29 lines
891 B
TypeScript
import type { GetServerSideProps, GetServerSidePropsContext } from "next";
|
|
import { notFound, redirect } from "next/navigation";
|
|
|
|
export const withAppDirSsr =
|
|
<T extends Record<string, any>>(getServerSideProps: GetServerSideProps<T>) =>
|
|
async (context: GetServerSidePropsContext) => {
|
|
const ssrResponse = await getServerSideProps(context);
|
|
|
|
if ("redirect" in ssrResponse) {
|
|
redirect(ssrResponse.redirect.destination);
|
|
}
|
|
if ("notFound" in ssrResponse) {
|
|
notFound();
|
|
}
|
|
|
|
const props = await Promise.resolve(ssrResponse.props);
|
|
|
|
return {
|
|
...props,
|
|
// includes dehydratedState required for future page trpcPropvider
|
|
...("trpcState" in props && {
|
|
dehydratedState: props.trpcState,
|
|
}),
|
|
...("isInfiniteScrollEnabled" in props && {
|
|
isInfiniteScrollEnabled: props.isInfiniteScrollEnabled,
|
|
}),
|
|
};
|
|
};
|