Skip to content

Commit

Permalink
git content provider checks the wrong cache key
Browse files Browse the repository at this point in the history
fixes #35559
  • Loading branch information
joaomoreno committed Oct 10, 2017
1 parent 74dfdf0 commit 7e49bfd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions extensions/git/src/contentProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class GitContentProvider {

const cacheKey = uri.toString();
const timestamp = new Date().getTime();
const cacheValue = { uri, timestamp };
const cacheValue: CacheRow = { uri, timestamp };

this.cache[cacheKey] = cacheValue;

Expand All @@ -108,7 +108,10 @@ export class GitContentProvider {

Object.keys(this.cache).forEach(key => {
const row = this.cache[key];
const isOpen = window.visibleTextEditors.some(e => e.document.toString() === row.uri.toString());
const { path } = fromGitUri(row.uri);
const isOpen = workspace.textDocuments
.filter(d => d.uri.scheme === 'file')
.some(d => d.uri.fsPath === path);

if (isOpen || now - row.timestamp < THREE_MINUTES) {
cache[row.uri.toString()] = row;
Expand Down

0 comments on commit 7e49bfd

Please sign in to comment.