We are querying entities using the new 'block' time travel feature. We query the Pool contract for the current prize size, then query it with past blocks to determine past prize sizes.
We use Apollo Client for our front-end. It's caching layer keys objects using "typename:id" to determine object uniqueness. The problem is that old "versions" of the Pool entity are clobbering new versions as they share the same key.
We solved this problem by adding a "version: BigInt" to each of our entities in schema.graphql that we need to pull historic data for. Any time we update those entities, we increment the version field.
I would have loved to add this increment code to the generated save() function, but we re-generate our code fairly often so it would be a pain to add it again every time.
Versioned entities definitely seems like the framework could provide pretty easily! It would be very useful to us.
We are querying entities using the new 'block' time travel feature. We query the Pool contract for the current prize size, then query it with past blocks to determine past prize sizes.
We use Apollo Client for our front-end. It's caching layer keys objects using "typename:id" to determine object uniqueness. The problem is that old "versions" of the Pool entity are clobbering new versions as they share the same key.
We solved this problem by adding a "version: BigInt" to each of our entities in
schema.graphql
that we need to pull historic data for. Any time we update those entities, we increment theversion
field.I would have loved to add this increment code to the generated
save()
function, but we re-generate our code fairly often so it would be a pain to add it again every time.Versioned entities definitely seems like the framework could provide pretty easily! It would be very useful to us.
Thanks!