Skip to content

Commit e9f8595

Browse files
committed
fix(renderer): clear permissions when resetting
There currently isn't a way to fetch a pending permission so when we're resetting, reject any pending permissions. Fixes #102
1 parent ba487c5 commit e9f8595

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lua/opencode/ui/renderer.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,17 @@ function M.reset()
4545

4646
state.messages = {}
4747
state.last_user_message = nil
48-
state.current_permission = nil
48+
49+
if state.current_permission then
50+
require('opencode.api').respond_to_permission('reject')
51+
state.current_permission = nil
52+
end
4953
trigger_on_data_rendered()
5054
end
5155

5256
---Set up all subscriptions, for both local and server events
5357
function M.setup_subscriptions(_)
54-
M._subscriptions.active_session = function(_, new, _)
58+
M._subscriptions.active_session = function(_, new, old)
5559
M.reset()
5660
if new then
5761
M.render_full_session()

0 commit comments

Comments
 (0)