File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,20 +87,19 @@ type model struct {
8787// method alters the model we also need to send along any commands returned.
8888func (m * model ) unloadDocument () {
8989 switch m .state {
90- case stateShowDocument :
91- m .pager .Unload ()
90+ case stateShowMenu :
91+ m .menu .Unload ()
9292
93- m .pager .ShowHelp = false
93+ m .menu .ShowHelp = false
9494
95- case stateShowResult :
95+ fallthrough
96+
97+ case stateShowDocument , stateShowResult :
98+ m .pager .Unload ()
9699 m .fullResult .Unload ()
97100
101+ m .pager .ShowHelp = false
98102 m .fullResult .ShowHelp = false
99-
100- case stateShowMenu :
101- m .menu .Unload ()
102-
103- m .menu .ShowHelp = false
104103 }
105104
106105 m .state = stateShowList
@@ -304,10 +303,7 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
304303 cmds = append (cmds , initCmds )
305304
306305 case command.EventListResources :
307- m .pager .Unload ()
308- m .menu .Unload ()
309-
310- m .state = stateShowList
306+ m .unloadDocument ()
311307
312308 case command.EventOpenResource :
313309 m .pager .Unload ()
@@ -323,8 +319,7 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
323319
324320 case menu.ChangeConfigMsg :
325321 m .list .YAMLs = nil
326- m .state = stateShowList
327- m .menu .Unload ()
322+ m .unloadDocument ()
328323
329324 err := m .cm .Cmd .ConfigureContext (msg .Context ,
330325 command .WithProfile (msg .To .Profile ),
You can’t perform that action at this time.
0 commit comments