浏览代码

Fix broken x-model

Caleb Porzio 1 年之前
父节点
当前提交
95232e4fae
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      packages/alpinejs/src/directives/x-model.js

+ 1 - 1
packages/alpinejs/src/directives/x-model.js

@@ -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
         }