Skip to content

Commit f478bb9

Browse files
committed
Revert "preview, project-shared - Normalize paths in fileInformationCache for cross-platform consistency"
This reverts commit b796ec4.
1 parent b796ec4 commit f478bb9

3 files changed

Lines changed: 7 additions & 78 deletions

File tree

‎src/command/preview/preview.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,10 @@ export async function renderForPreview(
429429
// fileInformationCache contains file content that needs to be refreshed.
430430
// TODO(#13955): Consider adding a dedicated invalidateForFile() method on ProjectContext
431431
if (project?.fileInformationCache) {
432-
project.fileInformationCache.delete(normalizePath(file));
432+
const normalizedFile = normalizePath(file);
433+
if (project.fileInformationCache.has(normalizedFile)) {
434+
project.fileInformationCache.delete(normalizedFile);
435+
}
433436
}
434437

435438
// render

‎src/project/project-shared.ts‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -505,18 +505,17 @@ export const ensureFileInformationCache = (
505505
project: ProjectContext,
506506
file: string,
507507
) => {
508-
const normalizedFile = normalizePath(file);
509508
if (!project.fileInformationCache) {
510509
project.fileInformationCache = new Map();
511510
}
512511
assert(
513512
project.fileInformationCache instanceof Map,
514513
JSON.stringify(project.fileInformationCache),
515514
);
516-
if (!project.fileInformationCache.has(normalizedFile)) {
517-
project.fileInformationCache.set(normalizedFile, {} as FileInformation);
515+
if (!project.fileInformationCache.has(file)) {
516+
project.fileInformationCache.set(file, {} as FileInformation);
518517
}
519-
return project.fileInformationCache.get(normalizedFile)!;
518+
return project.fileInformationCache.get(file)!;
520519
};
521520

522521
export async function projectResolveBrand(

‎tests/unit/project/file-information-cache.test.ts‎

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)