fix: bypass Vite tree-shake for pointCode via pointCodeMap

Vite's SSR build strips pointCode from ReviewPointResult return objects.
Workaround: pass a separate pointCodeMap from reviews.ts and apply it
in the route loader (reviews.tsx) which Vite preserves.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-23 20:39:08 +08:00
parent 20a8ed4466
commit 2694eeb011
2 changed files with 26 additions and 1 deletions
+7 -1
View File
@@ -786,7 +786,13 @@ export async function getReviewPoints(fileId: string, request: Request) {
};
// console.log("reviewInfo-------",JSON.stringify(reviewInfo,null,2));
// data->reviewPoints stats->statistics reviewInfo->reviewInfo document->document scoring_proposals->scoringProposalsData
return { data: resultData, stats, reviewInfo, document: documentData.data, comparison_document: comparisonDocument, scoring_proposals: scoringProposalsData };
// 构建 pointId -> code 映射(供 route loader 补充 pointCode,绕过 Vite tree-shake
const pointCodeMap: Record<string, string> = {};
evaluationPointsData.forEach(point => {
if (point.code) pointCodeMap[String(point.id)] = String(point.code);
});
return { data: resultData, stats, reviewInfo, document: documentData.data, comparison_document: comparisonDocument, scoring_proposals: scoringProposalsData, pointCodeMap };
}
/**