From ab0343338e506cfaa0ff44c846cda1ec5d20eded Mon Sep 17 00:00:00 2001 From: hyowons Date: Mon, 8 Jun 2026 17:16:54 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20stale=20=EC=A0=84=EC=B2=B4=20=EC=9E=AC?= =?UTF-8?q?=EA=B0=B1=EC=8B=A0=20=EC=8B=9C=20=ED=99=94=EB=A9=B4=20=ED=81=B4?= =?UTF-8?q?=EB=A6=AC=EC=96=B4=20=EB=8C=80=EC=8B=A0=20=EA=B8=B0=EC=A1=B4=20?= =?UTF-8?q?=EC=9C=A0=EC=A7=80+=EB=B0=B1=EA=B7=B8=EB=9D=BC=EC=9A=B4?= =?UTF-8?q?=EB=93=9C=20swap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5분 stale 재갱신이 resetShellLook()로 전탭을 스피너로 비우던 것 제거 → 기존 내용 유지한 채 fetch, 완료 시 교체. 로딩 표시는 새로고침(↻) 아이콘 스핀으로만(내용 그대로 보임). 실패 시 기존 내용 유지+에러 토스트. Co-Authored-By: Claude Opus 4.8 --- agents/stock/workspace/scripts/behive_web.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/agents/stock/workspace/scripts/behive_web.py b/agents/stock/workspace/scripts/behive_web.py index 03e6b06..2498f64 100644 --- a/agents/stock/workspace/scripts/behive_web.py +++ b/agents/stock/workspace/scripts/behive_web.py @@ -6425,10 +6425,12 @@ def render_html() -> str: 'window.__behive_chart_mode=chartMode;' 'window.__behive_adr_days=adrDays;' 'function load(owner,fresh){' - # 5분 이상 stale 상태에서 들어오면 모든 탭을 새로 채워야 하니 owner 부분 fetch도 전체로 승격. - 'if(lastLoadAt&&(Date.now()-lastLoadAt)>STALE_MS){resetShellLook();owner=null;}' + # 5분 이상 stale 면 전체로 승격하되, 화면은 클리어하지 않고 기존 내용 유지 → fetch 완료 시 교체(swap). + 'if(lastLoadAt&&(Date.now()-lastLoadAt)>STALE_MS){owner=null;}' 'var key=owner||"all";' 'if(!fresh&&inFlight[key])return inFlight[key];' + # 로딩 표시는 새로고침 아이콘 스핀으로만 (내용은 그대로 보임). + 'var rb=document.querySelector("a.refresh");if(rb)rb.classList.add("spinning");' 'var qs=[];if(owner)qs.push("owner="+encodeURIComponent(owner));if(fresh)qs.push("fresh=1");' 'var cd=chartDays();if(cd!==null)qs.push("chart_days="+cd);' 'var cu=chartUnit();if(cu!==null)qs.push("chart_unit="+cu);' @@ -6439,7 +6441,7 @@ def render_html() -> str: '.then(function(r){if(!r.ok)throw new Error("HTTP "+r.status);return r.json();})' '.then(function(j){apply(j);lastLoadAt=Date.now();})' '.catch(function(){failVisible("갱신 실패 — 다시 시도해주세요");});' - 'var done=function(){if(!fresh)delete inFlight[key];};' + 'var done=function(){if(!fresh)delete inFlight[key];if(rb&&!Object.keys(inFlight).length)rb.classList.remove("spinning");};' 'pr.finally?pr.finally(done):pr.then(done,done);' 'if(!fresh)inFlight[key]=pr;' 'return pr;'