Description
Re
entity.get(“*”)
can you talk a bit more about your use case? I ask because there are a lot of ways to go about implementing this. The underlying datalog DB does support patterns similar to this, but they have different tradeoffs when connecting them to React and doing the live updating. At the moment we treatentity.get(“specificAttribute”)
as a whitelist, so we only cache data and rerender components when those specific attributes change. If debugging is the issue we just released custom chrome formatters so you can log out entities and inspect all their attributes in the console. We’re also working on a chrome extension to read and eventually write to the database from a GUI. If it’s something more like GraphQL that you want, we’re talking about exposing the pull syntax which is essentially GraphQL. I’m hesitant to just expose anentity.get(“*”)
function since that would have severe performance costs in the context of React if used naively, and it’s ripe for naive use since it’s probably the first thing a new developer would try.
@smothers
re: entity.get("*"), this is roughly what I'm trying to do.
const onDragEnd = (event) => {
if (event.condition) {
transact([{
entity: {
name: baseEntity.get("name"),
component: baseEntity.get("component"),
width: baseEntity.get("width"),
height: baseEntity.get("height"),
ownerId: baseEntity.get("ownerId"),
// +maybe some other props I don't know about? and those could vary depending on the entity too.
}
}])
}
}
So again this is just querying the database directly, no need to subscribe to anything. but on the other hand if it is only exposed when querying the database directly, that could feel a bit inconsistent?
I'm actually not sure yet I will need it to be this dynamic, so hardcoding the props is okay in the meantime. but it was something I thought would be there and went looking for in the docs.
Cheers.
Originally posted by @MioQuispe in #80 (comment)