From d274e0c1170f6bdbe94a34f3084febc201ec6977 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Thu, 26 Feb 2026 22:44:32 -0500 Subject: [PATCH] fix(cache): replace stale M._cache field with get_raw_cache accessor Problem: M._cache = cache_data captured the initial empty table reference at module load time. After M.load() reassigns cache_data to the decoded JSON, M._cache is permanently stale and returns the wrong table. Solution: remove the field assignment and expose get_raw_cache() which closes over cache_data and always returns the current table. --- lua/cp/cache.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/cp/cache.lua b/lua/cp/cache.lua index efdcad7..33342c2 100644 --- a/lua/cp/cache.lua +++ b/lua/cp/cache.lua @@ -346,6 +346,8 @@ function M.get_data_pretty() return vim.inspect(cache_data) end -M._cache = cache_data +function M.get_raw_cache() + return cache_data +end return M