mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-30 16:39:33 +01:00
fix(web): keep Load full history on Loading… while it stands in for Reload (#814)
- A content-anchored Load full history pull sets _historyReloadActionLoadingFor and clears it on settle, as Reload history does. - The button renders from that loading state, so the re-render the in-flight pull triggers keeps it disabled on Loading…. - The top-anchor case keeps no loading state, so the bar still hides on a scroll back to live output.
This commit is contained in:
1 parent
a692f9f193
commit
e7f90cb3ec
3 files changed
+36
-5
No files matched your search
+15
-2
@@ -10054,7 +10054,11 @@ class CodemanApp {
|
||||
const btn = document.createElement('button');
|
||||
btn.type = 'button';
|
||||
btn.className = 'history-trunc-load';
|
||||
btn.textContent = 'Load full history';
|
||||
// A content-anchored pull from here stands in for Reload history, so it
|
||||
// shares Reload's loading state: the pull flips Reload eligibility, and the
|
||||
// re-render that follows must not bring the button back enabled mid-pull.
|
||||
btn.disabled = loading;
|
||||
btn.textContent = loading ? 'Loading…' : 'Load full history';
|
||||
btn.onclick = () => {
|
||||
btn.disabled = true;
|
||||
btn.textContent = 'Loading…';
|
||||
@@ -10064,7 +10068,16 @@ class CodemanApp {
|
||||
// way. Checked at click time, not render time: the bar only re-renders on
|
||||
// eligibility transitions, and the reader may have scrolled since.
|
||||
const anchor = this._historyReloadActionEligible() ? 'content' : 'top';
|
||||
this._maybeRefetchFullHistory({ force: true, anchor }).finally(() => {
|
||||
// The top anchor keeps no loading state: it would hold the bar up after
|
||||
// a scroll back to live output, where it hides today.
|
||||
if (anchor === 'content') {
|
||||
this._historyReloadActionLoadingFor = sessionId;
|
||||
this._syncHistoryReloadAction();
|
||||
}
|
||||
return this._maybeRefetchFullHistory({ force: true, anchor }).finally(() => {
|
||||
if (anchor === 'content' && this._historyReloadActionLoadingFor === sessionId) {
|
||||
this._historyReloadActionLoadingFor = null;
|
||||
}
|
||||
this._renderHistoryTruncationBanner();
|
||||
});
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user