Open krispya opened 3 weeks ago
Looks good. Yeah I think entity + trait can be an implementation detail eventually. Since the public listening API requires you to pass an Entity in all cases anyway (unless I'm missing some?). Storing the tuple (trait, entity) in the tracking list should greatly reduce the number of comparisons and thus improve perf, making auto
a save option in basically all cases. But since this issue is about the updateEach API, I think it's good as it is 👍
Only the React API makes you pass in an entity. The core API does not (onChange) and neither does tracking queries using the Changed modifier.
I see. Okay let's put that discussion in another issue, since this is pretty much agreed on.
Right now change detection is set per
updateEach
call manually, default off. The proposal is to make change detection beon
,off
, orauto
instead of a boolean, with default beingauto
. Ifauto
then it would follow these rules:onChange
are added to a tracking list.auto
tooff
.There was suggestion to make this even more specific, per entity per trait. There is no API for that currently (you can observe all entities for a given trait, not specific entities, and then filter for specific entities) so this should be opened as another issue.