u is not a function #4617
Unanswered
mikko-ahonen
asked this question in
5. Bugs
Replies: 1 comment
-
Alpine should automatically initialize the elements when they are added. There was a change in 13.4 that prevented double initializing elements. Is the element in the settle one that already existed before the swap? Or is it a new element? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I get an error "u is not a function" on this line:
cdn.min.js:5 Uncaught (in promise) TypeError: u is not a function
at cdn.min.js:5:7984
let l = Promise.all([c._x_hidePromise, ...(c._x_hideChildren || []).map(a)]).then( ([u]) => u());
My AlpineJS code is otherwise fairly straightforward, but I am loading the form again (using Django and HTMX). I could make it (almost) work only by calling initTree -- otherwise the loaded page is not re-evaluated.
The problem above arises (in my undertanding) when I am calling the initTree()
document.body.addEventListener('htmx:afterSettle', (event) => {
console.log('HTMX content swapped, reinitializing Alpine')
const swappedElement = event.detail.elt;
if (window.Alpine) {
window.Alpine.initTree(swappedElement);
}
});
I tested it with version 3.13.3 and the newest version. In 3.13.3 I get this error. On newest version I don't get the error, but the data is not initialized. Perhaps initTree changes in 3.13.4 have changed this behavior.
Beta Was this translation helpful? Give feedback.
All reactions