Skip to content

Commit ebd4ec0

Browse files
authored
Merge pull request #401 from fcollonval/fix-398
Fix caching server root
2 parents 0b4339f + 2d2f962 commit ebd4ec0

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/components/diff/DiffWidget.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,16 @@ export async function getRelativeFilePath(
8080
path: string,
8181
topRepoPath: string
8282
): Promise<string> {
83-
if (serverRootResultCache !== null) {
84-
return serverRootResultCache;
85-
} else {
83+
if (serverRootResultCache === null) {
8684
const response = await httpGitRequest('/git/server_root', 'GET', null);
8785
const responseData = await response.json();
88-
serverRootResultCache = PathExt.join(
89-
PathExt.relative(responseData['server_root'], topRepoPath),
90-
path
91-
);
92-
return serverRootResultCache;
86+
serverRootResultCache = responseData['server_root'];
9387
}
88+
89+
return PathExt.join(
90+
PathExt.relative(serverRootResultCache, topRepoPath),
91+
path
92+
);
9493
}
9594

9695
/**

0 commit comments

Comments
 (0)