From d5058004b992ed47d9c9478604f00768abb2aef9 Mon Sep 17 00:00:00 2001 From: cubatic45 Date: Wed, 4 Mar 2026 18:51:01 +0800 Subject: [PATCH] fix(loop): schedule debounced callbacks and check closed status --- lua/vgit/core/loop.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/vgit/core/loop.lua b/lua/vgit/core/loop.lua index 42856166..3399ccbe 100644 --- a/lua/vgit/core/loop.lua +++ b/lua/vgit/core/loop.lua @@ -31,7 +31,11 @@ function loop.debounce(fn, ms) timer:stop() timer:start(ms, 0, function() - fn(unpack(argv, 1, argc)) + vim.schedule(function() + if not closed then + fn(unpack(argv, 1, argc)) + end + end) end) end