dw-innovation / dw-kid2-graph-frontend-prototype

dw-kid2-graph-frontend-prototype.vercel.app
MIT License
0 stars 0 forks source link

Decide on a document strategy #41

Open nikonikoniko opened 2 years ago

nikonikoniko commented 2 years ago

At the moment, we subscribe to reactive queries in parent components. Then, we .get() each of the documents, and pass that document down through the react tree. This is great, because the child components don't have to .get() the documents again and simply react to changes.

However, we also lose a lot of other interesting abilities from the document, documented here

For example, an RxDocument has a built in .update() function.

Currently, we update the document using a db.upsertOne. This does not work in combination with all of the revision information, and must be removed as we can see in this commit:

https://github.com/dw-innovation/dw-kid2-graph-frontend-prototype/commit/a9bb8f8703a1641bfa5d7e2a4388195e8a02bdcc#diff-1e866b832c5c86d104b8003096008ce9cf6abd604b1154b8c325a2a9b64ecb4fR10-R24

We should decide on a strategy: do we pass arounf RxDocuments, or their version that we got with .get. We could also pass an update function down the tree.

nikonikoniko commented 2 years ago

One more strategy is that based on the obj they receive. they can make their own query to attatch to and update the document.

Interested in your feedback @tlmn