fix: set confirm_popup to nil as soon as the callback is called (#2191)

This commit is contained in:
Lite Ye
2025-06-09 02:03:46 -04:00
committed by GitHub
parent 60209c3d46
commit 0cce955816

View File

@@ -57,17 +57,13 @@ function M.confirm(message, callback, confirm_opts, session_ctx, tool_name)
M.confirm_popup = Confirm:new(message, function(type, reason)
if type == "yes" then
callback(true)
return
end
if type == "all" then
elseif type == "all" then
if session_ctx then session_ctx.always_yes = true end
callback(true)
return
end
if type == "no" then
elseif type == "no" then
callback(false, reason)
return
end
M.confirm_popup = nil
end, confirm_opts)
M.confirm_popup:open()
return M.confirm_popup