Skip to content

Commit

Permalink
Fetch x-init after running onBeforeComponentInitialized
Browse files Browse the repository at this point in the history
  • Loading branch information
stancl authored Mar 9, 2021
1 parent 8d2feaf commit 2bb7df5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default class Component {

const dataAttr = this.$el.getAttribute('x-data')
const dataExpression = dataAttr === '' ? '{}' : dataAttr
const initExpression = this.$el.getAttribute('x-init')

let dataExtras = {
$el: this.$el,
Expand Down Expand Up @@ -82,6 +81,8 @@ export default class Component {
this.showDirectiveLastElement

componentForClone || Alpine.onBeforeComponentInitializeds.forEach(callback => callback(this))

const initExpression = this.$el.getAttribute('x-init')

var initReturnedCallback
// If x-init is present AND we aren't cloning (skip x-init on clone)
Expand Down

0 comments on commit 2bb7df5

Please sign in to comment.