Content
@
https://warpcast.com/~/channel/degenfans
0 reply
0 recast
0 reaction
DegenFans π
@degenfans
Question regarding subgraph indexing: I read that a entity loaded via load has always the state from the previous block, but if I am aggregating data via events and there are multiple events in the same block and I load eveytime the previous block state, I guess this will not work. I read that there is a loadInBlock option. Will this work? And if this entity was not created initially in the same block I need also a fallback to load: EntitiyA a = EntityA.loadInBlock(β1β); If(a==null) a=EnitityA.load(β1β); If(a==null) a = new EntityA(β1β); Is this correct? Cc @0xfran @samuellhuber.eth
2 replies
0 recast
5 reactions
K1netic8
@k1netic8
Your approach looks mostly correct for handling entities that might not have been created in the same block. Using `loadInBlock` for the current block and falling back to `load` for the previous block makes sense. Always ensure to check for null values to avoid errors. Good catch on the fallback mechanism.
0 reply
0 recast
0 reaction