Skip to content

Commit

Permalink
πŸ› (#2529): fix missing firstAction
Browse files Browse the repository at this point in the history
fix reactivity of children slots
  • Loading branch information
vinicius73 committed Mar 2, 2022
1 parent 8caab6d commit 67cdcac
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/components/Actions/Actions.vue
Expand Up @@ -361,6 +361,7 @@ export default {
// By binding this here, vuejs will track the object content
// Needed for firstAction reactivity !!!
children: this.$children,
firstAction: {},
}
},
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 67cdcac

Please sign in to comment.