Yuki Takei 7 месяцев назад
Родитель
Сommit
e41850552f

+ 1 - 1
apps/app/src/pages/[[...path]]/utils.ts → apps/app/src/pages/[[...path]]/get-activity-action.ts

@@ -5,7 +5,7 @@ import type { SupportedActionType } from '~/interfaces/activity';
 
 
 import type { IPageToShowRevisionWithMeta } from './types';
 import type { IPageToShowRevisionWithMeta } from './types';
 
 
-export const getAction = (props: {
+export const getActivityAction = (props: {
   isNotCreatable: boolean;
   isNotCreatable: boolean;
   isForbidden: boolean;
   isForbidden: boolean;
   isNotFound: boolean;
   isNotFound: boolean;

+ 12 - 2
apps/app/src/pages/[[...path]]/server-side-props.ts

@@ -11,10 +11,10 @@ import {
   mergeGetServerSidePropsResults,
   mergeGetServerSidePropsResults,
 } from './common-helpers';
 } from './common-helpers';
 import { getServerSideConfigurationProps, getServerSideRendererConfigProps, getServerSideSidebarConfigProps } from './configuration-props';
 import { getServerSideConfigurationProps, getServerSideRendererConfigProps, getServerSideSidebarConfigProps } from './configuration-props';
+import { getActivityAction } from './get-activity-action';
 import { getPageDataForInitial, getPageDataForSameRoute } from './page-data-props';
 import { getPageDataForInitial, getPageDataForSameRoute } from './page-data-props';
 import type { InitialProps, SameRouteEachProps } from './types';
 import type { InitialProps, SameRouteEachProps } from './types';
 import { isValidInitialAndSameRouteProps, isValidSameRouteProps } from './types';
 import { isValidInitialAndSameRouteProps, isValidSameRouteProps } from './types';
-import { getAction } from './utils';
 
 
 const nextjsRoutingProps = {
 const nextjsRoutingProps = {
   props: {
   props: {
@@ -88,7 +88,7 @@ export async function getServerSidePropsForInitial(context: GetServerSidePropsCo
     throw new Error('Invalid merged props structure');
     throw new Error('Invalid merged props structure');
   }
   }
 
 
-  await addActivity(context, getAction(mergedProps));
+  await addActivity(context, getActivityAction(mergedProps));
   return mergedResult;
   return mergedResult;
 }
 }
 
 
@@ -135,5 +135,15 @@ export async function getServerSidePropsForSameRoute(context: GetServerSideProps
     throw new Error('Invalid same route props structure');
     throw new Error('Invalid same route props structure');
   }
   }
 
 
+  // -- TODO: persist activity
+
+  // const mergedProps = await mergedResult.props;
+
+  // // Type-safe props validation AFTER skipSSR is properly set
+  // if (!isValidSameRouteProps(mergedProps)) {
+  //   throw new Error('Invalid same route props structure');
+  // }
+
+  // await addActivity(context, getActivityAction(mergedProps));
   return mergedResult;
   return mergedResult;
 }
 }

+ 0 - 3
apps/app/src/pages/[[...path]]/types.ts

@@ -48,9 +48,6 @@ export type SameRouteEachProps = CommonEachProps & {
 
 
 export type Props = SameRouteEachProps | (InitialProps & SameRouteEachProps);
 export type Props = SameRouteEachProps | (InitialProps & SameRouteEachProps);
 
 
-// Helper types for extended props
-export type ExtendedInitialProps = InitialProps & SameRouteEachProps;
-
 /**
 /**
  * Type guard for SameRouteEachProps validation
  * Type guard for SameRouteEachProps validation
  * Lightweight validation for same-route navigation
  * Lightweight validation for same-route navigation