fix(web): keep Reload history off while the incoming tab loads (#814)

- _historyReloadActionEligible() also requires no terminal load state:
  selectSession sets it before switching activeSessionId, so the sync
  right after the switch no longer offers Reload for the loading tab.
- _clearTerminalLoadState() re-syncs the action, so a marked tab offers
  Reload once its load ends.
- Changeset: note the reading-position fix for live flushes at the
  scrollback cap.
This commit is contained in:
Hadrien Kerlero committed 2026-11-22 02:44:23 +01:00
1 parent b4d729a054
commit 5f0366c060
5 files changed
+101 -1

No files matched your search

+15
View File
@@ -987,6 +987,7 @@ describe('manual history banner action', () => {
detached: false,
enabled: true,
loadingBuffer: false,
loadState: false,
paneHistoryLines: undefined as number | undefined,
...options,
};
@@ -1026,6 +1027,7 @@ describe('manual history banner action', () => {
_historyNoticeRevealedFor: null as string | null,
_fullHistoryRepullInFlight: Boolean(state.inFlight),
_isLoadingBuffer: Boolean(state.loadingBuffer),
terminalLoadStates: new Map(state.loadState ? [['s1', { generation: 1, phase: 'resizing' }]] : []),
_paneHistoryLines: new Map<string, number>(
state.paneHistoryLines === undefined ? [] : [['s1', Number(state.paneHistoryLines)]]
),
@@ -1058,6 +1060,7 @@ describe('manual history banner action', () => {
{ opts: { paneHistoryLines: 0 }, visible: true },
{ opts: { paneHistoryLines: 5 }, visible: true },
{ opts: { loadingBuffer: true }, visible: false },
{ opts: { loadState: true }, visible: false },
{ opts: { tiles: true }, visible: false },
{ opts: { active: false }, visible: false },
{ opts: { detached: true }, visible: false },
@@ -1102,6 +1105,18 @@ describe('manual history banner action', () => {
expect(bar.hidden).toBe(true);
});
it('shows the action when the matching terminal load state clears', () => {
const { app, bar, button } = fixture({ loadState: true });
Object.assign(app, { _updateTerminalLoadTab: vi.fn() });
app._syncHistoryReloadAction();
expect(bar.hidden).toBe(true);
expect(button()).toBeUndefined();
loadAppMethod('_clearTerminalLoadState').call(app, 's1', 1);
expect(app.terminalLoadStates.has('s1')).toBe(false);
expect(bar.hidden).toBe(false);
expect(button()!.textContent).toBe('Reload history');
});
it('syncs the action after a marked session finishes loading', () => {
const { app, bar, button } = fixture({ marked: false });
const owner = (mixin._beginBufferLoad as Function).call(app);