Skip to content

Commit

Permalink
fix(ui.results): prevent race conditions on set_title between results…
Browse files Browse the repository at this point in the history
… retrieved and spinner
  • Loading branch information
danielefongo committed Jan 7, 2025
1 parent 986f678 commit 6ea75d9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/microscope/ui/results.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ local function get_focused(self)
end

local function stop_spinner(self)
self.spinner_running = false
timer.clear_timeout(self.spinner_timer)
self.spinner_timer = nil

Expand All @@ -74,6 +75,7 @@ local function on_new_request(self, request)
self.selected_data = {}
self.results = {}
self.request = request
self.spinner_running = true

self:set_title("", "center")

Expand All @@ -89,7 +91,9 @@ local function on_new_request(self, request)
end

vim.schedule(function()
self:set_title(symbol, self.spinner.position)
if self.spinner_running == true then
self:set_title(symbol, self.spinner.position)
end
end)
end)
end
Expand Down

0 comments on commit 6ea75d9

Please sign in to comment.