You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Component entities can be implicitly created by nesting maps in a transaction. However, in DataScript 0.9.0, as far as I can tell:
If explicit :db/id vals are omitted from within the nested maps,
And if other non-component entities are also created elsewhere in the same transaction,
Then :db/id vals may be generated that unexpectedly refer to both the new component entities and the non-component entities.
This can create circular references: if a new entity is created simultaneously with its component entity, then they may end up sharing the same ID. (This also currently can thus result in an infinite loop when using the Pull API; see #58.)
Including an explicit temporary ID (e.g., -1) in the components' parent entity is enough to correct the problem and to cause the other components to receive disjunct IDs, but I'm assuming that implicit temporary IDs are intended to be supported, as per DataScript Chat’s code.
Component entities can be implicitly created by nesting maps in a transaction. However, in DataScript 0.9.0, as far as I can tell:
:db/id
vals are omitted from within the nested maps,:db/id
vals may be generated that unexpectedly refer to both the new component entities and the non-component entities.This can create circular references: if a new entity is created simultaneously with its component entity, then they may end up sharing the same ID. (This also currently can thus result in an infinite loop when using the Pull API; see #58.)
Including an explicit temporary ID (e.g.,
-1
) in the components' parent entity is enough to correct the problem and to cause the other components to receive disjunct IDs, but I'm assuming that implicit temporary IDs are intended to be supported, as per DataScript Chat’s code.A demonstration script of this behavior is at https://gist.github.com/cigitia/feafd70768fcd551cd16.
DataScript is amazing; thank you for creating it.
The text was updated successfully, but these errors were encountered: