OverviewFilesCommitsIssuesDocsReleasesPeers

godot-keet commits / b28f50a

Fix cluster disappearing: read cached data instead of stale RPC
- KeetGraph.last_clusters caches clusters from compute() - room_list_panel reads last_clusters directly instead of calling get_clusters() which triggered a fresh members-only compute, returned 0 clusters, and wiped group_bar icons via clusters_loaded Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
b28f50a02d91d61c2f7cc24088e7ae8f23dd19e1
by plankatron <fleeky@gmail.com> · 2026-02-23T02:59:58.000Z

Changed files (2) +23 -23

addons/keet_social/keet_graph.gd +5 -3
……@@ -8,6 +8,7 @@ signal edges_loaded(edges: Array)
88signal error_occurred(message: String)
99
1010var client: KeetUdsClient
11var last_clusters: Array = [] ## Cached clusters from last compute — read directly, no RPC
1112
1213
1314## Compute full graph (cached 60s, use force=true to recompute).
……@@ -23,11 +24,12 @@ func compute(force: bool = false, algo: Dictionary = {}, callback: Callable = Ca
2324 error_occurred.emit("compute: %s" % str(err))
2425 return
2526 var r: Dictionary = result if result is Dictionary else {}
26 graph_computed.emit(r)
27 # Also emit clusters_loaded so group_bar gets clusters from compute()
27 # Cache clusters locally so other panels can read without RPC
2828 var clusters: Array = r.get("clusters", []) if r is Dictionary else []
2929 if clusters is Array:
30 clusters_loaded.emit(clusters)
30 last_clusters = clusters
31 graph_computed.emit(r)
32 clusters_loaded.emit(last_clusters)
3133 if callback.is_valid():
3234 callback.call(r)
3335 )
scripts/room_list_panel.gd +18 -20
……@@ -124,26 +124,24 @@ func _on_group_changed(group_id: String) -> void:
124124 if _group_rooms_key != group_id:
125125 _group_rooms.clear()
126126 _group_rooms_key = group_id
127 KeetService.graph_mgr.get_clusters({}, func(clusters):
128 if _active_group != group_id:
129 return # stale
130 for c: Variant in clusters:
131 if not c is Dictionary:
132 continue
133 if "cluster:%d" % c.get("id", -1) == group_id:
134 _group_rooms.clear()
135 for rid: Variant in c.get("rooms", []):
136 _group_rooms.append({"roomId": str(rid)})
137 # Cache cluster label/topics for display
138 var label: String = str(c.get("label", ""))
139 var topics: Variant = c.get("topics", [])
140 if label != "":
141 _cluster_meta_cache[group_id] = {"label": label, "topics": topics}
142 # Update title now that we have metadata
143 title_label.text = _get_group_display_name(group_id)
144 _build_joined_group_rooms()
145 return
146 )
127 # Read cached clusters directly — do NOT call get_clusters() which
128 # triggers a fresh compute with default algo and wipes group_bar icons
129 var clusters: Array = KeetService.graph_mgr.last_clusters
130 for c: Variant in clusters:
131 if not c is Dictionary:
132 continue
133 if "cluster:%d" % c.get("id", -1) == group_id:
134 _group_rooms.clear()
135 for rid: Variant in c.get("rooms", []):
136 _group_rooms.append({"roomId": str(rid)})
137 # Cache cluster label/topics for display
138 var label: String = str(c.get("label", ""))
139 var topics: Variant = c.get("topics", [])
140 if label != "":
141 _cluster_meta_cache[group_id] = {"label": label, "topics": topics}
142 title_label.text = _get_group_display_name(group_id)
143 _build_joined_group_rooms()
144 break
147145 else:
148146 # Discovery registry — existing logic
149147 if group_id != prev_group: