Skip to content

Commit 6b37927

Browse files
committed
fix(event): prevent loading event handler more than once in some cases
1 parent 25f6009 commit 6b37927

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lua/lazy/core/handler/event.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ function M:_add(value)
1515
---@type string?, string?
1616
local event, pattern = event_spec:match("^(%w+)%s+(.*)$")
1717
event = event or event_spec
18+
local done = false
1819
vim.api.nvim_create_autocmd(event, {
1920
group = self.group,
2021
once = true,
2122
pattern = pattern,
2223
callback = function(ev)
23-
if not self.active[value] then
24+
if done or not self.active[value] then
2425
return
2526
end
27+
done = true
2628
Util.track({ [self.type] = value })
2729
local groups = M.get_augroups(ev.event, pattern)
2830
-- load the plugins

0 commit comments

Comments
 (0)