DashboardcraftCraft config.ts caches: _configCache, _…

Craft config.ts caches: _configCache, _globalGitHubConfigCache, _configPathCache

Category: pattern
Confidence: 0.85
ID: 019f897f-6cd5-7c10-ae03-f32f6d0b77eb
Project ID: e16af391-c497-4837-b681-c849a5514499
Cross-project: No
Recalled in other projects: 0
Source session: 0HCQB0NNZ4Qpt2k8P
Created: 2026-07-22 11:04:17
Updated: 2026-07-22 11:04:17

Content

src/config.ts holds three module-level caches: _configPathCache (found config file path — invariant across workspace selection, never cleared), _configCache (resolved CraftProjectConfig — cleared by setActiveWorkspace), _globalGitHubConfigCache (typed GitHubGlobalConfig | null | undefined: undefined = not yet computed, null = computed-and-not-found; cleared by setActiveWorkspace since GitHub config can differ per workspace). When adding a new workspace-dependent derived value, mirror this: add a module-level cache, clear it inside setActiveWorkspace(), and keep undefined/null distinct when 'not found' is itself a valid computed result (don't collapse both to one sentinel).

Move to: