From 67cdcac4929b35402cbf0dbdedd6c06e74ae0ef4 Mon Sep 17 00:00:00 2001 From: Vinicius Reis Date: Wed, 2 Mar 2022 18:40:55 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20(#2529):=20fix=20missing=20first?= =?UTF-8?q?Action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix reactivity of children slots --- src/components/Actions/Actions.vue | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/components/Actions/Actions.vue b/src/components/Actions/Actions.vue index 681235787d..d12614934b 100644 --- a/src/components/Actions/Actions.vue +++ b/src/components/Actions/Actions.vue @@ -361,6 +361,7 @@ export default { // By binding this here, vuejs will track the object content // Needed for firstAction reactivity !!! children: this.$children, + firstAction: {}, } }, @@ -399,18 +400,6 @@ export default { firstActionVNode() { return this.actions[0] }, - /** - * Reactive binding to the first children - * Since we're here, it means we already passed all the proper checks - * we can assume the first action is the first children too - * @returns {Object} first action vue children object - */ - firstAction() { - return this.children[0] - ? this.children[0] - : {} - }, - /** * Binding of the first action to the template * @returns {Object} vue template v-bind shortcut @@ -482,6 +471,18 @@ export default { this.opened = state }, + /** + * Reactive binding to the first children + * Since we're here, it means we already passed all the proper checks + * we can assume the first action is the first children too + */ + children() { + // Fix #2529, slots maybe not available on creation lifecycle + // first action vue children object + this.firstAction = this.children[0] + ? this.children[0] + : {} + }, }, beforeMount() { // init actions