MCPcopy Create free account
hub / github.com/AGenUI/AGenUI / onNodeAdded

Method onNodeAdded

core/src/surface/agenui_surface.cpp:291–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289}
290
291void Surface::onNodeAdded(const std::string& parentId, const std::string& nodeJson) {
292 auto json = nlohmann::json::parse(nodeJson, nullptr, false);
293 if (json.is_discarded() || !json.contains("id") || !json["id"].is_string()) {
294 AGENUI_LOG("failed to parse componentId from nodeJson");
295 return;
296 }
297
298 AGENUI_LOG("onNodeAdded: %s, parentId:%s", nodeJson.c_str(), parentId.c_str());
299 std::string componentId = json["id"].get<std::string>();
300 if (!_surfaceManager) return;
301 ComponentsAddMessage message;
302 message.parentId = parentId;
303 message.componentId = componentId;
304 message.component = nodeJson;
305 _pendingDispatches.emplace_back(std::move(message));
306 _dispatchGuard.requestFlush();
307}
308
309void Surface::onNodeRemoved(const std::string& parentId, const std::string& id) {
310 AGENUI_LOG("onNodeRemoved: %s, parentId:%s", id.c_str(), parentId.c_str());

Callers 1

notifyComponentAddedMethod · 0.80

Calls 3

containsMethod · 0.80
c_strMethod · 0.80
requestFlushMethod · 0.80

Tested by

no test coverage detected