MCPcopy Create free account
hub / github.com/modem-dev/hunk / buildCacheKey

Function buildCacheKey

src/ui/diff/useHighlightedDiff.ts:82–84  ·  view source on GitHub ↗

Cache key that includes a content fingerprint so stale entries are never served * after reload. Unchanged files keep their cache hit across reloads.

(theme: AppTheme, file: DiffFile)

Source from the content-addressed store, hash-verified

80/** Cache key that includes a content fingerprint so stale entries are never served
81 * after reload. Unchanged files keep their cache hit across reloads. */
82function buildCacheKey(theme: AppTheme, file: DiffFile) {
83 return `${theme.id}:${theme.syntaxTheme ?? theme.appearance}:${file.id}:${patchFingerprint(file)}`;
84}
85
86/** Only commit a highlight result if the promise is still the active one for that key.
87 * Prevents a superseded or late-resolving promise from overwriting a newer entry. */

Callers 2

useHighlightedDiffFunction · 0.85

Calls 1

patchFingerprintFunction · 0.85

Tested by

no test coverage detected