Files
iNaturalistReactNative/tests/factories/RemoteObservation.js
Ken-ichi b18fd0408b Crash when uploading after deleting unsynced observation (#1010)
Syncing was broken when an unsynced obs was deleted

The main problem here was that MyObs state has a list of observations that
need upload, but since it was a plain array of Realm objects it crashed when
one of those objects was invalid, which happened after deletion. This fix
isn't great: it just makes it so the thing in state is a Realm.Results
object, which will update dynamically when its underlying data changes. We
could also JSONify what we have in state, but then you get into problems of
nested objects and deep JSONification.

Also
* Delete local obs if remote doesn't exist
* Bugfix: ObsDetail tried to mark non-existent remote obs as viewed
* Tried to handle react query retries better
2024-01-09 14:47:07 -08:00

18 lines
428 B
JavaScript

import { define } from "factoria";
import userFactory from "./RemoteUser";
export default define( "RemoteObservation", faker => ( {
id: faker.number.int( ),
uuid: faker.string.uuid( ),
geojson: {
coordinates: [
Number( faker.location.longitude( ) ),
Number( faker.location.latitude( ) )
]
},
positional_accuracy: 10,
observed_on_string: "2020-04-03",
user: userFactory( "RemoteUser" )
} ) );