Skip to content

Commit bb2e75b

Browse files
core: frontend: components: zenoh-inspector: Freeze cytoscape Core against Vue reactivity
Vue 2 deep-observed the Core; fcose per-frame mutations froze the tab
1 parent 84ede96 commit bb2e75b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

core/frontend/src/components/zenoh-inspector/ZenohNetwork.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,10 @@ export default Vue.extend({
114114
const elements = this.prepareCytoscapeElements()
115115
cytoscape.use(fcose)
116116
117-
this.cy = cytoscape({
117+
// Object.freeze keeps Vue 2 from making the cytoscape Core deeply reactive; without it the
118+
// fcose layout's per-frame position mutations trigger reactivity over the whole Core and
119+
// peg the CPU/freeze the tab.
120+
this.cy = Object.freeze(cytoscape({
118121
container,
119122
boxSelectionEnabled: false,
120123
elements,
@@ -128,7 +131,7 @@ export default Vue.extend({
128131
nodeRepulsion: 25000,
129132
},
130133
style: this.getCytoscapeStyle(),
131-
})
134+
}))
132135
133136
console.log('[Zenoh Network] Cytoscape initialized successfully')
134137
} catch (error) {

0 commit comments

Comments
 (0)