x-for effect called after cleanup #4362
Unanswered
PierreTurnbull
asked this question in
5. Bugs
Replies: 1 comment
-
Solved in #4300 which should be included in the next release. |
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
-
Hi,
I encountered the following error on https://github.com/alpinejs/alpine/blob/v3.14.1/packages/alpinejs/src/directives/x-for.js#L94:
It seems like the
effect
function is called after thecleanup
function, which I suppose must not happen.After hours or digging I am still unsure of the exact cause. I am not even sure it is an actual bug, or just a misuse from my part. It seems to have something to do with multiple factors: template nesting, getters, watchers, recreation of arrays.
Here is a minimal reproduction example. Note that reasons why I made certain choices, such as destructuring
groups
in theorphanItems
getter, might not be clear. That is because I simplified the code a lot to make it easier to debug.If it is a bug, unfortunately I am not able to dig further. I have already lost many hair on this and I feel like I am reaching my limits.
If it's a misuse from my part, I would love to understand what I am doing wrong that causes this problem, and also suggest to handle this error with a meaningful message to explain the misuse.
I found a similar discussion, although I am unsure it is related : #1837
Beta Was this translation helpful? Give feedback.
All reactions