Skip to content

Commit

Permalink
Fix broken x-model
Browse files Browse the repository at this point in the history
  • Loading branch information
calebporzio committed Dec 11, 2023
1 parent fa9b39a commit 95232e4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/alpinejs/src/directives/x-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ directive('model', (el, { modifiers, expression }, { effect, cleanup }) => {

// The following code prevents an infinite loop when using:
// x-model="$model" by retreiving an x-model higher in the tree...
if (result._x_modelAccessor) {
if (typeof result === 'object' && result !== null && result._x_modelAccessor) {
return result._x_modelAccessor.closest
}

Expand Down

0 comments on commit 95232e4

Please sign in to comment.