Skip to content

Commit 07fd7ad

Browse files
committedJan 11, 2023
fix(cache): use cached chunk when specs are loading for valid plugins
1 parent e1cd9cd commit 07fd7ad

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎lua/lazy/core/cache.lua

+3-2
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,13 @@ function M.check_autoload(modname, modpath)
7777
-- only needed when the plugin mod has been loaded
7878
---@type LazyCorePlugin
7979
local Plugin = package.loaded["lazy.core.plugin"]
80-
if Plugin and not Plugin.loading then
80+
if Plugin then
8181
local plugin = Plugin.find(modpath)
8282
if plugin and modpath:find(plugin.dir, 1, true) == 1 then
8383
-- we're not interested in loader time, so calculate delta here
8484
M.stats.autoload.time = M.stats.autoload.time + uv.hrtime() - start
85-
if not plugin._.loaded then
85+
-- don't load if we're loading specs or if the plugin is already loaded
86+
if not (Plugin.loading or plugin._.loaded) then
8687
if plugin.module == false then
8788
error("Plugin " .. plugin.name .. " is not loaded and is configured with module=false")
8889
end

0 commit comments

Comments
 (0)
Please sign in to comment.