Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions apps/app/src/pages/[[...path]]/server-side-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,20 @@ export async function getServerSidePropsForInitial(
export async function getServerSidePropsForSameRoute(
context: GetServerSidePropsContext,
): Promise<GetServerSidePropsResult<Stage2EachProps>> {
// Get page data
const result = await getPageDataForSameRoute(context);
// -- TODO: :https://redmine.weseek.co.jp/issues/174725
// Remove getServerSideI18nProps from getServerSidePropsForSameRoute for performance improvement
const [i18nPropsResult, pageDataResult] = await Promise.all([
getServerSideI18nProps(context, ['translation']),
getPageDataForSameRoute(context),
]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

他の NextPage と同様にページ遷移毎に毎回 getPageDataForSameRoute を getServerSideI18nProps を実行するように修正

Admin

const [commonInitialResult, i18nResult] = await Promise.all([
getServerSideCommonInitialProps(context),
getServerSideI18nProps(context, ['admin'], options),
]);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getServerSideI18nProps のコストって低いのかな?
その結論付けがないまま安易に追加したくない

admin はページ遷移時のパフォーマンスを気にしないので安易に追加していいと思っている

もしコストが低いなら追加してOK、高い可能性があるなら言語変更した際はリロードを促すなどすればいいと思う


// -- TODO: persist activity

// const mergedProps = await mergedResult.props;
// await addActivity(context, getActivityAction(mergedProps));
return result;
const mergedResult = mergeGetServerSidePropsResults(
pageDataResult,
i18nPropsResult,
);

return mergedResult;
}
Loading