Open MikeGlennFWC opened 3 years ago
no, this is expected behavior on WatermelonDB side and a bug on your backend, however it's likely that it's been obscured before and now visible because of 0.23 changes.
record stays created most likely because it was changed between push beginning and completion. however, your server should treat created
and updated
records essentially the same way - the distinction is kind of arbitrary at this point. https://github.com/Nozbe/WatermelonDB/blob/master/docs-master/Advanced/Sync.md#implementing-push-endpoint
Ok, thanks. I'll update to follow this.
One more thing, in your backend implementations, do you have _changes and _status fields on your backend database?
One more thing, in your backend implementations, do you have _changes and _status fields on your backend database?
No
Sorry, I'm over thinking it, of course you don't.
I'm now upserting created records, which fixes the issue.
last question, is WatermelonDB ok with receiving the same record in created changes on a pull, even if it's already created that record? because that will happen in the above instance if it's upserted.
It used to throw a warning, but safely updated it.
last question, is WatermelonDB ok with receiving the same record in created changes on a pull, even if it's already created that record?
yes
Hello,
I have a local device record that is
created
, then moments later isupdated
again by the device.The
created
record hits the server and syncs fine.Then the record is updated on the local device, but the
_status
column is marked ascreated
This tries to send the record again on next sync as
created
, but this should be in theupdated
list. The server rejects the sync because it finds a duplicate key in the database as it tries to insert with the same ID but updated values.I have a screenshot showing the status of
created
but it showing 2 columns updated.Is this something to do with the way i have set up WatermelonDB, or is this a bug? I'm using version 0.23.0