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
On our project we use deleted for the deleted field on our graphql backend, so that means I have set deletedField: 'deleted' on the replication options. When I write a custom conflict handler to try to merge changes, I was surprised to see a discrepancy.
The types for the conflictHandler.resolve method indicate that the shape of assumedMasterState and newDocumentState is identical to the shape of realMasterState. But at runtime, that does not appear to be true.
Since we are using the deletedField option and changing it, I could just account for this in the handler logic by type-asserting that the assumed state and new state actually have a slightly different shape than the real state. I would just make sure to return a resolution that matches the real state. But I figured I should submit an issue just in case anyone else has run into this.
The logic would certainly be easier to write/understand if the same field was used at runtime for every entry in the RxConflictHandlerInput<Item>. So is this behaving as expected already? If not, should the values in RxConflictHandlerInput<Item> all have the user configured deleted or the internal RxDB _deleted?
The text was updated successfully, but these errors were encountered:
On our project we use
deleted
for the deleted field on our graphql backend, so that means I have setdeletedField: 'deleted'
on the replication options. When I write a custom conflict handler to try to merge changes, I was surprised to see a discrepancy.The types for the
conflictHandler.resolve
method indicate that the shape ofassumedMasterState
andnewDocumentState
is identical to the shape ofrealMasterState
. But at runtime, that does not appear to be true.Since we are using the
deletedField
option and changing it, I could just account for this in the handler logic by type-asserting that the assumed state and new state actually have a slightly different shape than the real state. I would just make sure to return a resolution that matches the real state. But I figured I should submit an issue just in case anyone else has run into this.Here is a snippet of the object I console logged.
The logic would certainly be easier to write/understand if the same field was used at runtime for every entry in the
RxConflictHandlerInput<Item>
. So is this behaving as expected already? If not, should the values inRxConflictHandlerInput<Item>
all have the user configureddeleted
or the internal RxDB_deleted
?The text was updated successfully, but these errors were encountered: