fix: Refresh preview pane after resume and modal actions#288
Open
maiconpavi wants to merge 2 commits intosmtg-ai:mainfrom
Open
fix: Refresh preview pane after resume and modal actions#288maiconpavi wants to merge 2 commits intosmtg-ai:mainfrom
maiconpavi wants to merge 2 commits intosmtg-ai:mainfrom
Conversation
The KeyResume handler returns without calling m.instanceChanged(), so the preview pane keeps the cached "Session is paused. Press 'r' to resume." fallback after the user presses r. The 100ms previewTickMsg loop usually masks the gap, but if the event loop is busy with anything else (metadata work, large diff stats) the stale fallback can stay on screen long enough to be noticeable. Batch m.instanceChanged() alongside tea.WindowSize() in the resume return, matching the shape used by case startInstanceMsg in the same file. The KeyCheckout (pause) handler already calls instanceChanged after Pause(), so this aligns the resume side with the existing pause pattern.
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
confirmAction's OnConfirm callback discarded the tea.Msg returned by
the action (_ = action()), so:
- KeyKill's instanceChangedMsg{} was dropped, leaving the preview
pane stuck on the killed instance's paused fallback until the next
previewTickMsg or until the user pressed Up/Down.
- KeySubmit's pushAction errors were also dropped; the user saw no
feedback when push failed.
Stash the action's returned message on a new home.pendingMsg field
inside OnConfirm, then drain it back into the event loop from the
stateConfirm branch of handleKeyPress when the overlay dismisses.
The existing case instanceChangedMsg: and case error: handlers do
the rest.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The preview pane keeps a cached
previewStatethat only changes whenm.instanceChanged()runs. Two lifecycle events were not triggering that call, so the pane stayed frozen on stale text until the nextpreviewTickMsg(or until the user pressed Up/Down, which has its own explicitinstanceChangedcall).Root cause (Resume):
case keys.KeyResumeinapp/app.goreturnstea.WindowSize()only, while the correspondingcase keys.KeyCheckout(pause) callsinstanceChanged()afterPause().Fix (Resume): Batch
m.instanceChanged()alongsidetea.WindowSize()in the resume return, matching the shape used bycase startInstanceMsgin the same file.Root cause (Kill / confirmation modal):
confirmAction'sOnConfirmcallback discards thetea.Msgreturned by the action (_ = action()). The kill path'sinstanceChangedMsg{}is dropped, so the preview pane keeps the killed instance's paused fallback. The push path's error returns are dropped the same way.Fix (Kill / confirmation modal): Stash the action's returned message on a new
home.pendingMsgfield insideOnConfirm, then drain it back into the event loop from thestateConfirmbranch ofhandleKeyPresswhen the overlay dismisses. The existingcase instanceChangedMsg:andcase error:handlers do the rest.Tested by:
cthenr; preview redraws to live tmux content on the same frame instead of one tick later.cthenD; preview redraws to the new selected instance immediately instead of staying stuck on the killed instance's paused fallback.P(push) failure; the error now appears in the err box instead of being silently swallowed.