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:
@@ -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 };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user