lvwerra HF Staff commited on
Commit
9cfa933
·
verified ·
1 Parent(s): 5b69c9d

Chart: disable entry animation; skip re-render when entries unchanged

Browse files
Files changed (1) hide show
  1. static/index.html +22 -0
static/index.html CHANGED
@@ -1806,8 +1806,26 @@ const NON_BEST_LABEL_BORDER = 'rgba(107,114,128,0.2)';
1806
  const NON_BEST_LABEL_TEXT = '#6b7280';
1807
  const GRID_COLOR = 'rgba(0,0,0,0.05)';
1808
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1809
  function renderChart(entries) {
1810
  if (!window.Chart) return;
 
 
 
 
 
1811
  if (chart) { chart.destroy(); chart = null; }
1812
 
1813
  // Baselines are fixed historical references, not events on this collab's
@@ -2026,6 +2044,10 @@ function renderChart(entries) {
2026
  },
2027
  },
2028
  interaction: { mode: 'nearest', intersect: true },
 
 
 
 
2029
  },
2030
  plugins: [bestLabels, nonBestLabels],
2031
  });
 
1806
  const NON_BEST_LABEL_TEXT = '#6b7280';
1807
  const GRID_COLOR = 'rgba(0,0,0,0.05)';
1808
 
1809
+ // Hash of the entries last passed to renderChart. We rebuild the chart only
1810
+ // when the data actually changes; the periodic poll otherwise no-ops here.
1811
+ let lastChartSignature = null;
1812
+
1813
+ function entriesSignature(entries) {
1814
+ // Stable string capturing everything renderChart cares about: score, agent,
1815
+ // status, method, date, run text. Order-independent.
1816
+ return [...entries]
1817
+ .map(e => `${e.score}|${e.agent}|${e.status || ''}|${e.method || ''}|${e.date || ''}|${e.run || ''}`)
1818
+ .sort()
1819
+ .join('\n');
1820
+ }
1821
+
1822
  function renderChart(entries) {
1823
  if (!window.Chart) return;
1824
+
1825
+ const sig = entriesSignature(entries);
1826
+ if (chart && sig === lastChartSignature) return;
1827
+ lastChartSignature = sig;
1828
+
1829
  if (chart) { chart.destroy(); chart = null; }
1830
 
1831
  // Baselines are fixed historical references, not events on this collab's
 
2044
  },
2045
  },
2046
  interaction: { mode: 'nearest', intersect: true },
2047
+ // No entry-animation. The chart re-instantiates whenever the data
2048
+ // changes (we no-op when it hasn't), but agents live with the chart
2049
+ // for long stretches so the swooping-in animation gets repetitive.
2050
+ animation: false,
2051
  },
2052
  plugins: [bestLabels, nonBestLabels],
2053
  });