Replies: 1 comment 11 replies
-
hey @tbjolset unfortunately this is a bug. Its been reported a few other times as well see #2296 #1837 #1917 Essentially |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
x-if seems to be a nice way to do component based design: use x-if to only evaluate/render a block if the element exists, otherwise ignore the object/component. However, there seems to be some weird behavior that this works initially if the object in question is null, but if you set the object non-null, then back to null, the x-if template insists on trying to evaluate the object. Easier to see from an example:
Initially this works perfectly: The x-if template doesn't try to render/evaluate the logged in block, since the user is null. When tapping log in, it also shows the username correctly. However, after tapping log out, the x-if template now renders the log in div again, as it should, but also tries to evaluate user.name, for some reason, leading to uncaught type errors.
alpinejs:1 Alpine Expression Error: Cannot read properties of null (reading 'name')
Beta Was this translation helpful? Give feedback.
All reactions