Selected Capability State Desync when Capabilities updated
- Dominant language
- JavaScript
- Stars
- 400
- Forks
- 89
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 146
Description
### Current Behavior
The Vue store fails to synchronize or reset the `selectedCapability` state when the global `capabilities` list is updated. This results in the UI passing stale or non-existent capabilities after a store update to the rag agent / mcp server.
While the Vue store correctly updates the list of capabilities when they change, the selected capability pointer remains unchanged.
Currently, we lack a unique identifier in the server payload from the ff-assistant to reliably map an old selection to a new one. To fix this "properly," we would need a composite key consisting of instance.id and nodeId. Without this, the frontend cannot verify if the previously selected was modified.
### Expected Behavior
#### Quick fix
- Reset on Update: Explicitly clear the selectedCapability state whenever a change in the capabilities array is detected.
- Reset on Mode Switch: Clear the selectedCapability state when the user toggles between the Expert’s Support and Insights modes.
#### Long run fix
- expose the mcp server's node.id in the capabilities payload
- update the `selectedCapabilities` entry whenever a change in the capabilities array is detected
### Steps To Reproduce
1. Open the FF-Assistant while in the immersive mode in an instance where an MCP server is defined.
2. Select a specific capability from the list.
3. Update a server's name in the Node-Red editor through the immersive editor, save and deploy flows
4. Check the `product/expert` store `operator-agent/capabilities` and `operator-agent/selectedCapabilities` properties
### Environment
- FlowFuse version:
- Node.js version:
- npm version:
- Platform/OS:
- Browser:
### Have you provided an initial effort estimate for this issue?
I have provided an initial effort estimate
Contributor guide
Assessment
This issue has not been assessed yet.