-
This is not really a bug report but more a request for documentation refinement. I was creating a component like this the other day
This worked pretty fine except when I created a second (same) component some days later I run in a host of errors that perplexed me totally and cost me the better part of an afternoon. The issue is that when I set a property within an function within a x-data structure and that particular property IS NOT defined as part of the x-data declaration, then setting said property will lead to the creation/setting of a global JS variable with the same name and then If I have multiple components that do that they will share the values of said global variable. Like I said this is not necessarily a bug but at least a behavior that should be documented and even prominently stated thx |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Do you have an example to replicate. It works as expected for me: https://codepen.io/SimoTod/pen/yyBRgRV |
Beta Was this translation helpful? Give feedback.
Do you have an example to replicate. It works as expected for me: https://codepen.io/SimoTod/pen/yyBRgRV
In general, it's better to always set a default empty state for your variable as there could be a directive trying to access your variable before init finishes (for example, it's waiting for a promise to resolve or similar cases).