@@ -1000,9 +1000,8 @@ export function updateSelectedUcComponentState(state, data) {
10001000 * - leaves with isSelected:false -> ignored (Studio cannot remove)
10011001 * - leaves not mentioned at all -> left alone (no wipe)
10021002 *
1003- * Removals happen only via locallyMarkUcComponents when ZAP itself issues a
1004- * remove POST and Studio responds 2xx. ucComponents (the catalog used for
1005- * labels / metadata) is always merged so we keep accumulating entries.
1003+ * ucComponents (the catalog used for labels / metadata) is always merged so
1004+ * we keep accumulating entries.
10061005 *
10071006 * @param {* } state
10081007 * @param {any[] } treeLeaves Flattened list of leaf nodes from Studio's tree.
@@ -1037,52 +1036,6 @@ export function applyUcComponentUpdate(state, treeLeaves) {
10371036 vue3Set ( state . studio , 'ucComponents' , [ ...allById . values ( ) ] )
10381037}
10391038
1040- /**
1041- * Apply the result of a locally-issued component install/uninstall POST.
1042- *
1043- * ZAP is the local source of truth for what it has asked Studio to install or
1044- * remove. A 2xx response from the POST means Studio acknowledged the change,
1045- * so we mirror that result into selectedUcComponents immediately. Any later
1046- * Studio WebSocket tree that contradicts this (see applyUcComponentUpdate)
1047- * is ignored for the unselect direction.
1048- *
1049- * @param {* } state
1050- * @param {{ ids: string[], added: boolean } } payload
1051- */
1052- export function applyLocalUcComponentChange ( state , payload ) {
1053- if ( ! payload || ! Array . isArray ( payload . ids ) || payload . ids . length === 0 )
1054- return
1055- const added = payload . added === true
1056- const prevSelected = Array . isArray ( state . studio . selectedUcComponents )
1057- ? state . studio . selectedUcComponents
1058- : [ ]
1059- const selectedById = new Map (
1060- prevSelected . filter ( ( x ) => x && x . id != null ) . map ( ( x ) => [ String ( x . id ) , x ] )
1061- )
1062- for ( const rawId of payload . ids ) {
1063- if ( rawId == null ) continue
1064- const key = String ( rawId )
1065- if ( added ) {
1066- if ( ! selectedById . has ( key ) ) {
1067- selectedById . set ( key , { id : key , isSelected : true } )
1068- }
1069- } else {
1070- selectedById . delete ( key )
1071- }
1072- }
1073- vue3Set ( state . studio , 'selectedUcComponents' , [ ...selectedById . values ( ) ] )
1074- }
1075-
1076- /**
1077- * Backward-compat alias for the action's commit name. Kept thin so call sites
1078- * can use either name interchangeably.
1079- * @param {* } state
1080- * @param {* } payload
1081- */
1082- export function locallyMarkUcComponents ( state , payload ) {
1083- applyLocalUcComponentChange ( state , payload )
1084- }
1085-
10861039/**
10871040 * Track which cluster ids ZAP has successfully asked Studio to install (or
10881041 * uninstall) components for. The missing-component warning is gated by this
0 commit comments