Replies: 6 comments 6 replies
-
I am having a similar issue if Worked fine in v2. Hat to wrap the
|
Beta Was this translation helpful? Give feedback.
-
Also discovered the proposed workaround by @wlhrtr myself, but just wanted to add, that for me even wrapping a |
Beta Was this translation helpful? Give feedback.
-
The same problem occurs with x-models within an x-if template. The x-models refers to the properties of an object. I made a codepen reproducing the issue (it's a rough copy of my project: just click "create a notification": the error appears on clicking the "create" button appearing at the bottom of the page) https://codepen.io/pafael/pen/NWjYwmV?editors=1001 [edit] PS: wrapping the x-models with another x-if template to check that the object is not undefined does NOT work. |
Beta Was this translation helpful? Give feedback.
-
You have to have a spacer between two template tags: <template x-if>
<div>
<template x-for> I do think there is a bug when you have |
Beta Was this translation helpful? Give feedback.
-
I've also been experiencing this while converting our app from 2.x to 3.x. While slightly more complicated (and possibly another issue at play here) just wanted to link this issue as well in case anyone stumbles here from google #1917 |
Beta Was this translation helpful? Give feedback.
-
Hi, is there any update on this? I currently experience an issue because |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Discussed in #1730
Originally posted by AdamSCMM July 6, 2021
I have code where an x-if wraps an x-for to stop the x-for from running if the variables are not correct. In v2 this code worked correctly, in v3 the x-for throws an error:
can't access property "length", items is undefined
even though the x-if should be stopping it beforehand.I've tried a few different ways of writing the if statement, but nothing seems to make a difference
The code looks like:
You can see a working example at the codepen below. Click 5 or 7 and then null or clear. It breaks when it should not. 5 to 7 works fine
https://codepen.io/acxz/pen/mdmeJRo?editors=1010
It was already suggested to me to add a
|| []
at the end of the for to account for the collection being undefined, but that shouldn't be necessary. This situation should not be occurring like thisBeta Was this translation helpful? Give feedback.
All reactions