feat: implement dynamic knowledge graph updates and state management services
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
@inject IMediator Mediator
|
||||
@inject IJSRuntime JS
|
||||
@inject IFocusModeService FocusMode
|
||||
@inject IKnowledgeGraphService GraphService
|
||||
|
||||
<div class="knowledge-graph-container" id="@ContainerId">
|
||||
@if (GraphData == null)
|
||||
@@ -37,6 +38,21 @@
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
FocusMode.OnFocusModeChanged += HandleFocusSimulation;
|
||||
GraphService.OnGraphUpdated += HandleGraphUpdate;
|
||||
GraphService.OnActiveNodeChanged += HandleActiveNodeChange;
|
||||
}
|
||||
|
||||
private async void HandleGraphUpdate()
|
||||
{
|
||||
if (_module == null) return;
|
||||
await _module.InvokeVoidAsync("updateData", GraphService.CurrentGraphData);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private async void HandleActiveNodeChange(string nodeId)
|
||||
{
|
||||
if (_module == null) return;
|
||||
await _module.InvokeVoidAsync("setActiveNode", nodeId);
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
|
||||
Reference in New Issue
Block a user