Skip to content

Commit

Permalink
fix(router): make sure we retry views that could not render due to E5…
Browse files Browse the repository at this point in the history
…65. Fixes #783
  • Loading branch information
folke committed May 3, 2024
1 parent f8283c9 commit 6df3d8a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 8 additions & 2 deletions lua/noice/message/router.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function M.update()
message = messages,
},
}, { messages = view._messages })
if #view._messages ~= count then
if #view._messages ~= count or view._dirty then
updates[view] = true
end
end
Expand All @@ -211,11 +211,17 @@ function M.update()

Manager.clear()

local dirty = false
for view, _ in pairs(updates) do
view:display()
if view._dirty then
dirty = true
end
end

M._tick = Manager.tick()
if not dirty then
M._tick = Manager.tick()
end

if not vim.tbl_isempty(updates) then
Util.stats.track("router.update.updated")
Expand Down
7 changes: 6 additions & 1 deletion lua/noice/view/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ local Format = require("noice.text.format")
---@field _route_opts NoiceViewOptions
---@field _visible boolean
---@field _instance "opts" | "view" | "backend"
---@field _dirty boolean?
---@overload fun(opts?: NoiceViewOptions): NoiceView
local View = Object("NoiceView")

Expand Down Expand Up @@ -137,7 +138,11 @@ function View:display()
Format.align(self._messages, self._opts.align)
self:check_options()

Util.try(self.show, self)
Util.try(function()
self._dirty = true
self:show()
self._dirty = false
end)

self._visible = true
else
Expand Down

0 comments on commit 6df3d8a

Please sign in to comment.