chore: remove all temporary debug instrumentation
Investigations are closed, so strip the probes: bzDbg + __perfProbe definitions, the older/render/slide/pwaFocus call sites, and the server-side /api/dbg (MDBG) sink. Kept the functional code around each probe (renderThread's innerHTML build, the older-page re-anchor, the slide fade). No behavior change. build batch153. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+2
-24
@@ -1158,7 +1158,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<script src="/icons.js?v=6"></script>
|
||||
<script>window.__BUILD='2026-07-22-batch152';console.log('%cBiz Connect','color:#1F3B73;font-weight:bold','build '+window.__BUILD);
|
||||
<script>window.__BUILD='2026-07-22-batch153';console.log('%cBiz Connect','color:#1F3B73;font-weight:bold','build '+window.__BUILD);
|
||||
// Emoji are rendered with the OS's own (colour) emoji font — instant, zero network.
|
||||
//
|
||||
// We used to run Twemoji over every emoji, which swapped each one for an <img> pulled INDIVIDUALLY from
|
||||
@@ -1168,23 +1168,6 @@
|
||||
// existing call sites don't have to change.
|
||||
function twemojify(_el){ /* native emoji: nothing to do */ }</script>
|
||||
<script>
|
||||
// TEMP perf diagnostics → /api/dbg (server log). Remove once slide/scroll jank is fixed.
|
||||
window.bzDbg=function(tag,extra){ try{ var p={tag:tag,build:window.__BUILD}; if(extra) for(var k in extra) p[k]=extra[k]; fetch('/api/dbg',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(p)}).catch(function(){}); }catch(e){} };
|
||||
// Measures frame gaps + long tasks over a window (the chat-open slide). Big maxGap / long tasks == the
|
||||
// main thread is blocked (jank); small gaps == the compositor is running the slide smoothly.
|
||||
window.__perfProbe=function(label){ try{
|
||||
var frames=[], last=performance.now(), start=last, longtasks=[], po=null;
|
||||
try{ po=new PerformanceObserver(function(l){ l.getEntries().forEach(function(e){ longtasks.push(Math.round(e.duration)); }); }); po.observe({entryTypes:['longtask']}); }catch(_){}
|
||||
(function tick(now){ frames.push(Math.round(now-last)); last=now;
|
||||
if(now-start<650){ requestAnimationFrame(tick); }
|
||||
else { if(po) try{po.disconnect();}catch(_){}
|
||||
var max=0; for(var i=1;i<frames.length;i++) if(frames[i]>max) max=frames[i];
|
||||
var over=frames.filter(function(d){return d>24;}).length;
|
||||
window.bzDbg('slidePerf',{label:label||'', frames:frames.length, maxGapMs:max, jankFrames:over, longtasks:longtasks, gaps:frames.slice(0,40)}); }
|
||||
})(last);
|
||||
}catch(e){} };
|
||||
</script>
|
||||
<script>
|
||||
// Native shell tag (iOS/Android). Safe-area insets are handled natively by the @capacitor-community/
|
||||
// safe-area plugin (it makes env(safe-area-inset-*) report real values), so there's no JS status-bar
|
||||
// juggling here — we only tag <html> so CSS can make small native-only tweaks if needed.
|
||||
@@ -1563,11 +1546,8 @@ async function loadOlder(){
|
||||
const have=new Set(THREAD.map(m=>m.id)); const add=older.filter(m=>!have.has(m.id));
|
||||
if(add.length){ THREAD=add.concat(THREAD); THREAD_CACHE.set(kind+':'+id, THREAD.slice()); }
|
||||
if(older.length<PAGE) _hasMoreOlder=false;
|
||||
if(window.__perfProbe) window.__perfProbe('older'); // TEMP: measure frame timing during the older-page render
|
||||
const _beforeTop = box?box.scrollTop:0;
|
||||
renderThread(true); // keep scroll (don't jump to bottom)
|
||||
_restore(); // put the anchor message back at its exact viewport position
|
||||
if(window.bzDbg && box) window.bzDbg('older',{added:add.length, beforeScrollTop:Math.round(_beforeTop), afterScrollTop:Math.round(box.scrollTop), scrollH:Math.round(box.scrollHeight)}); // TEMP: did the anchor hold?
|
||||
if(box){ const imgs=[...box.querySelectorAll('.bubble img')].filter(im=>!im.complete); imgs.forEach(im=>im.addEventListener('load', _restore, {once:true})); setTimeout(()=>imgs.forEach(im=>{ try{ im.removeEventListener('load', _restore); }catch(_){} }), 3000); } // re-anchor as prepended images load (they'd shift it down)
|
||||
} else { _hasMoreOlder=false; }
|
||||
_loadingOlder=false; _olderCd=Date.now()+500; // brief cooldown so it can't re-fire and fight the scroll
|
||||
@@ -2806,7 +2786,7 @@ function renderThread(keepScroll){
|
||||
if(!THREAD.length){ box.innerHTML='<div class="empty-thread">No messages yet — say hello 👋</div>'; return; }
|
||||
let html='';
|
||||
for(const m of THREAD){ const dk=dayKey(m.created_at); if(dk!==_lastDay){ html+='<div class="day-sep"><span>'+pEsc(dayLabel(m.created_at))+'</span></div>'; _lastDay=dk; } rendered.add(m.id); html+=bubbleHTML(m); }
|
||||
var _rt0=performance.now(); box.innerHTML=html; twemojify(box); if(window.bzDbg && !keepScroll) window.bzDbg('render',{n:THREAD.length, innerHtmlKb:Math.round(html.length/1024), renderMs:Math.round(performance.now()-_rt0)}); // TEMP: how long the sync DOM build costs
|
||||
box.innerHTML=html; twemojify(box);
|
||||
if(!keepScroll){
|
||||
if(_convoRevealed){
|
||||
// #7: a later render during the SAME open (network arriving after the cache render) — just stay at
|
||||
@@ -2889,7 +2869,6 @@ function armOpenSlide(){
|
||||
if(c) c.addEventListener('transitionend', _slideEndHandler);
|
||||
requestAnimationFrame(()=>{
|
||||
if(window.__slideTok!==token) return;
|
||||
if(window.__perfProbe) window.__perfProbe('slide'); // TEMP: measure frame timing over the open
|
||||
if(c) c.classList.add('chat-fadein'); // slide translateX(12%)->0 + opacity 0->1 (pure compositor)
|
||||
window.__chatOpenT=setTimeout(done, 320); // fallback if transitionend is missed (240ms + margin)
|
||||
});
|
||||
@@ -2927,7 +2906,6 @@ async function openConvo(kind,id){
|
||||
inpEl.addEventListener('input', ()=>{ maybeAutocorrect(inpEl); autoGrow(inpEl); setDraft(kind,id,inpEl.value); noteTyping(); }); // auto-correct common typos, keep the draft in sync + emit "typing…"
|
||||
inpEl.addEventListener('blur', ()=>{ stopTyping(); setTimeout(()=>{ const a=document.activeElement; const stillTyping=a&&(a.tagName==='TEXTAREA'||a.tagName==='INPUT'); if(!stillTyping && window.__bzResetKb) window.__bzResetKb(); }, 120); }); // #1: composer lost focus → keyboard is closing → drop the --kb lift so no empty gap remains
|
||||
inpEl.addEventListener('keydown', (e)=>{ if(e.key==='Enter' && !e.shiftKey && !isMobileUA()){ if(mentionItems && mentionItems.length) return; e.preventDefault(); sendMessage(); } }); // Desktop: Enter sends, Shift+Enter = newline. Mobile: the Return key inserts a newline (default) — you send with the send button, like every native chat app.
|
||||
inpEl.addEventListener('focus', ()=>{ setTimeout(()=>{ try{ var vv=window.visualViewport; var se=document.scrollingElement||document.documentElement; if(window.bzDbg) window.bzDbg('pwaFocus',{ scale: vv?Math.round(vv.scale*100)/100:0, vvW: vv?Math.round(vv.width):0, vvH: vv?Math.round(vv.height):0, vvTop: vv?Math.round(vv.offsetTop):0, innerW: window.innerWidth, innerH: window.innerHeight, clientH: document.documentElement.clientHeight, scrollY: Math.round((se&&se.scrollTop)||window.scrollY||0), compFont: getComputedStyle(inpEl).fontSize, kb: getComputedStyle(document.documentElement).getPropertyValue('--kb').trim(), disp: (window.matchMedia('(display-mode: standalone)').matches?'standalone':'browser'), dpr: window.devicePixelRatio }); }catch(e){} }, 400); }); // TEMP: capture what actually happens on composer focus in the PWA (scale=zoom? scrollY=page pushed? compFont=is 16px applied?)
|
||||
// Desktop: LEFT-click a red-squiggled word → native spelling suggestions right there (the shell
|
||||
// pops a suggestions menu only if the clicked word is actually misspelled). No right-click needed.
|
||||
if(window.bizConnectNative && window.bizConnectNative.spellSuggestAt){
|
||||
|
||||
@@ -1005,13 +1005,6 @@ try {
|
||||
} catch (_) {}
|
||||
route('GET', '/api/build', (req, res) => json(res, 200, { build: APP_BUILD }));
|
||||
|
||||
// TEMP perf/debug sink — the app POSTs slide frame-timing + scroll state so we diagnose jank from the
|
||||
// server log (docker logs bizgaze-support) with real device numbers. Remove once the slide/scroll settle.
|
||||
route('POST', '/api/dbg', async (req, res) => {
|
||||
try { const b = await readBody(req); console.log('[MDBG]', JSON.stringify(b)); } catch (_) {}
|
||||
json(res, 200, { ok: true });
|
||||
});
|
||||
|
||||
// Mint a LiveKit join token for the signed-in user + a specific room (the 6-digit meeting code).
|
||||
// The room-membership/host authorization already happens over the meeting WebSocket; this only
|
||||
// hands the client a media-plane credential scoped to that room and its own identity.
|
||||
|
||||
Reference in New Issue
Block a user