refactor(file-browser): Replace plain object directory cache with Map - #2831
Merged
bajrangCoder merged 1 commit intoAug 29, 2026
Merged
Conversation
Replace the plain object container used for cached directories with an ES6 `Map` to improve key management semantics. Update cached directory data structure (`src/pages/fileBrowser/fileBrowser.js`): - Re-initialize `cachedDir` variable as a `Map` - Replace object property lookups with `Map.prototype.has()` and `Map.prototype.get()` - Update cache writes to use `Map.prototype.set()` - Update directory deletion calls to use `Map.prototype.delete()` (AI generated commit message)
Contributor
Greptile SummaryReplaces the file browser’s plain-object directory cache with an ES6
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness or security issues identified. All directory-cache operations consistently use Important Files Changed
Reviews (1): Last reviewed commit: "refactor(file-browser): Convert director..." | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the plain object (
{}) used for directory caching (cachedDir) insrc/pages/fileBrowser/fileBrowser.jswith an ES6Mapinstance.Motivation
Object.prototype, which can lead to collisions or unexpected behavior if file paths match built-in property names.Mapprovides clean key isolation.References
Summary of Code Changes
src/pages/fileBrowser/fileBrowser.js:cachedDirvariable usingnew Map().url in cachedDirwithcachedDir.has(url).cachedDir[url]access withcachedDir.get(url).cachedDir[dir.url] = dirwithcachedDir.set(dir.url, dir).delete cachedDir[url]with nativecachedDir.delete(url).(PR name and description are AI generated (Gemini 3.6 flash))