fix(nvim): correctly close the alpha timer for dashboard

This commit is contained in:
Price Hiller 2024-01-18 05:59:17 -06:00
parent 483bc7b282
commit 665e83b6dc
Signed by: Price
SSH Key Fingerprint: SHA256:Y4S9ZzYphRn1W1kbJerJFO6GGsfu9O70VaBSxJO7dF8

View File

@ -183,7 +183,12 @@ return {
50, 50,
1000, 1000,
vim.schedule_wrap(function() vim.schedule_wrap(function()
vim.cmd("AlphaRedraw") ---@diagnostic disable-next-line: param-type-mismatch
local success, _ = pcall(vim.cmd, "AlphaRedraw")
if not success and not alpha_timer:is_closing() then
vim.api.nvim_del_autocmd(args.id)
alpha_timer:close()
end
end) end)
) )
@ -192,8 +197,10 @@ return {
desc = "Shut down alpha timer", desc = "Shut down alpha timer",
callback = function() callback = function()
---@diagnostic disable-next-line: need-check-nil ---@diagnostic disable-next-line: need-check-nil
alpha_timer:close() if not alpha_timer:is_closing() then
vim.api.nvim_del_autocmd(args.id) alpha_timer:close()
vim.api.nvim_del_autocmd(args.id)
end
return true return true
end, end,
}) })