claude-opencode-viewer 2.6.40 → 2.6.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index-pc.html CHANGED
@@ -1637,6 +1637,9 @@
1637
1637
  modeSelect.value = msg.mode;
1638
1638
  document.getElementById('mode-label').textContent = '';
1639
1639
  }
1640
+ if (msg.running) {
1641
+ preloadData();
1642
+ }
1640
1643
  // 服务端无运行进程,显示启动对话框
1641
1644
  if (!msg.running && !startupDialogShown) {
1642
1645
  startupDialogShown = true;
@@ -2220,7 +2223,32 @@
2220
2223
  var docsLoading = false;
2221
2224
 
2222
2225
  function preloadData() {
2223
- // 预加载已移除,改为按需查询:首次打开面板时查询并缓存,刷新按钮才重新查
2226
+ if (!gitStatusLoading) {
2227
+ gitStatusLoading = true;
2228
+ fetch(basePath + '/api/git-status')
2229
+ .then(function(r) { return r.json(); })
2230
+ .then(function(data) {
2231
+ cachedGitStatus = data;
2232
+ gitStatusLoading = false;
2233
+ if (diffBarVisible) {
2234
+ diffChanges = data.changes || [];
2235
+ document.getElementById('git-diff-count').textContent = diffChanges.length;
2236
+ renderDiffFileList();
2237
+ }
2238
+ })
2239
+ .catch(function() { gitStatusLoading = false; });
2240
+ }
2241
+ if (!docsLoading) {
2242
+ docsLoading = true;
2243
+ fetch(basePath + '/api/docs')
2244
+ .then(function(r) { return r.json(); })
2245
+ .then(function(data) {
2246
+ cachedDocs = data;
2247
+ docsLoading = false;
2248
+ if (docsBarVisible) renderDocsList(data);
2249
+ })
2250
+ .catch(function() { docsLoading = false; });
2251
+ }
2224
2252
  }
2225
2253
 
2226
2254
  var STATUS_COLORS = {
package/index.html CHANGED
@@ -1621,6 +1621,9 @@
1621
1621
  }
1622
1622
  }
1623
1623
  else if (msg.type === 'state') {
1624
+ if (msg.running) {
1625
+ preloadData();
1626
+ }
1624
1627
  // 服务端还没启动进程时,查最近会话并自动恢复
1625
1628
  if (!msg.running && !mobileInitSent) {
1626
1629
  mobileInitSent = true;
@@ -2475,7 +2478,32 @@
2475
2478
  var docsLoading = false;
2476
2479
 
2477
2480
  function preloadData() {
2478
- // 预加载已移除,改为按需查询:首次打开面板时查询并缓存,刷新按钮才重新查
2481
+ if (!gitStatusLoading) {
2482
+ gitStatusLoading = true;
2483
+ fetch(basePath + '/api/git-status')
2484
+ .then(function(r) { return r.json(); })
2485
+ .then(function(data) {
2486
+ cachedGitStatus = data;
2487
+ gitStatusLoading = false;
2488
+ if (diffBarVisible) {
2489
+ diffChanges = data.changes || [];
2490
+ document.getElementById('git-diff-count').textContent = diffChanges.length;
2491
+ renderDiffFileList();
2492
+ }
2493
+ })
2494
+ .catch(function() { gitStatusLoading = false; });
2495
+ }
2496
+ if (!docsLoading) {
2497
+ docsLoading = true;
2498
+ fetch(basePath + '/api/docs')
2499
+ .then(function(r) { return r.json(); })
2500
+ .then(function(data) {
2501
+ cachedDocs = data;
2502
+ docsLoading = false;
2503
+ if (docsBarVisible) renderDocsList(data);
2504
+ })
2505
+ .catch(function() { docsLoading = false; });
2506
+ }
2479
2507
  }
2480
2508
 
2481
2509
  var STATUS_COLORS = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-opencode-viewer",
3
- "version": "2.6.40",
3
+ "version": "2.6.42",
4
4
  "description": "A unified terminal viewer for Claude Code and OpenCode with seamless switching",
5
5
  "type": "module",
6
6
  "main": "server.js",