Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lua/gitlab/actions/discussions/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ M.open = function(callback, view_type)
split:mount()

-- Initialize winbar module with data from buffers
winbar.start_timer()
winbar.set_buffers(M.linked_bufnr, M.unlinked_bufnr)
winbar.switch_view_type(view_type)

Expand Down Expand Up @@ -156,6 +157,7 @@ M.close = function()
end
M.split_visible = false
M.discussion_tree = nil
winbar.cleanup_timer()
end

---Move to the discussion tree at the discussion from diagnostic on current line.
Expand Down
19 changes: 16 additions & 3 deletions lua/gitlab/actions/discussions/winbar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,21 @@ M.switch_view_type = function(override)
M.update_winbar()
end

-- Set up a timer to update the winbar periodically
local timer = vim.uv.new_timer()
timer:start(0, 100, vim.schedule_wrap(M.update_winbar))
---Set up a timer to update the winbar periodically
M.start_timer = function()
M.cleanup_timer()
---@type nil|uv_timer_t
M.timer = vim.uv.new_timer()
M.timer:start(0, 100, vim.schedule_wrap(M.update_winbar))
end

--Stop and close the timer
M.cleanup_timer = function()
if M.timer ~= nil then
M.timer:stop()
M.timer:close()
M.timer = nil
end
end

return M
1 change: 1 addition & 0 deletions lua/gitlab/reviewer/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ M.open = function()
local on_diffview_closed = function(view)
if view.tabpage == M.tabnr then
M.tabnr = nil
require("gitlab.actions.discussions.winbar").cleanup_timer()
end
end
require("diffview.config").user_emitter:on("view_closed", function(_, args)
Expand Down
Loading