Skip to content

Commit 0540c40

Browse files
authored
Merge pull request #65 from retejs/fix/ref-components
Fix/ref components
2 parents b4de9d5 + 0db40b9 commit 0540c40

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/Ref.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ export default defineComponent({
1010
mounted() {
1111
this.emit({ type: 'render', data: { ...this.data, element: this.$refs.element } })
1212
},
13+
beforeDestroy() {
14+
this.emit({ type: 'unmount', data: { element: this.$refs.element } })
15+
},
1316
beforeUnmount() {
1417
this.emit({ type: 'unmount', data: { element: this.$refs.element } })
1518
}

src/presets/classic/components/Node.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.title(data-testid="title") {{data.label}}
44

55
// Outputs
6-
.output(v-for='[key, output] in outputs()' :key="key + seed" :data-testid="'output-'+key")
6+
.output(v-for='[key, output] in outputs()' :key="'output' + key + seed" :data-testid="'output-'+key")
77
.output-title(data-testid="output-title") {{output.label}}
88
Ref.output-socket(
99
:data="{ type: 'socket', side: 'output', key: key, nodeId: data.id, payload: output.socket }"
@@ -13,14 +13,14 @@
1313
// Controls
1414
Ref.control(
1515
v-for='[key, control] in controls()',
16-
:key="key + seed",
16+
:key="'control' + key + seed",
1717
:data-testid="'control-'+key"
1818
:emit="emit"
1919
:data="{ type: 'control', payload: control }"
2020
)
2121

2222
// Inputs
23-
.input(v-for='[key, input] in inputs()' :key="key + seed" :data-testid="'input-'+key")
23+
.input(v-for='[key, input] in inputs()' :key="'input' + key + seed" :data-testid="'input-'+key")
2424
Ref.input-socket(
2525
:data="{ type: 'socket', side: 'input', key: key, nodeId: data.id, payload: input.socket }"
2626
:emit="emit"

src/vuecompat/vue2.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function create(element: any, component: any, payload: any, onRendered: a
44
const app = new Vue({
55
props: ['payload'],
66
render(h) {
7-
return h(component, { props: this.payload, ref: 'child' })
7+
return h(component, { props: { ...this.payload, seed: Math.random() }, ref: 'child' })
88
},
99
mounted() {
1010
onRendered()

0 commit comments

Comments
 (0)