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.
This commit is contained in:
parent
3cb872a65f
commit
d274e0c117
1 changed files with 3 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue