@rsktash/beads-ui 0.1.42 → 0.1.43

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server/ws.js +10 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsktash/beads-ui",
3
- "version": "0.1.42",
3
+ "version": "0.1.43",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/rsktash/beads-ui.git"
package/server/ws.js CHANGED
@@ -9,6 +9,7 @@ import { isRequest, makeError, makeOk } from '../app/protocol.js';
9
9
  import { isAuthEnabled, verifyToken } from './auth.js';
10
10
  import { getGitUserName, runBd, runBdJson } from './bd.js';
11
11
  import { resolveWorkspaceDatabase } from './db.js';
12
+ import { rebindDoltServer } from './dolt-pool.js';
12
13
  import {
13
14
  addComment,
14
15
  addDependency,
@@ -615,14 +616,20 @@ export function attachWsServer(http_server, options = {}) {
615
616
  DB_WATCHER.rebind({ root_dir: resolved_root });
616
617
  }
617
618
 
618
- // Clear existing registry entries and refresh all subscriptions
619
+ // Clear existing registry entries
619
620
  registry.clear();
620
621
 
621
622
  // Broadcast workspace-changed event to all clients
622
623
  broadcast('workspace-changed', CURRENT_WORKSPACE);
623
624
 
624
- // Schedule refresh of all active list subscriptions
625
- scheduleListRefresh();
625
+ // Rebind the Dolt SQL pool THEN refresh subscriptions
626
+ rebindDoltServer(resolved_root).then((pool) => {
627
+ log('Dolt pool rebound for %s: %s', resolved_root, pool ? 'connected' : 'unavailable');
628
+ scheduleListRefresh();
629
+ }).catch((err) => {
630
+ log('rebindDoltServer error: %o', err);
631
+ scheduleListRefresh();
632
+ });
626
633
  }
627
634
 
628
635
  return { changed, workspace: CURRENT_WORKSPACE };