Commit Graph

7 Commits

Author SHA1 Message Date
Ryan Stelly
b78be9243d lint rule & autofix for "trailing comma" (#3299)
* (lint) MOB-1063 enforce trailing commas

* autofix trailing commas

* manually fix newly introduced maxlen violations

* add trailing comma convention to i18n build
2025-12-22 20:17:13 -06:00
Corey Farwell
7a9fc4e647 Shutdown Realm after tests complete to avoid Jest open connections warning. (#3161) 2025-10-28 13:24:28 +01:00
Ken-ichi Ueda
4545d72e2f Ensure default realm instance is always unique for a single run 2024-08-07 12:18:58 -07:00
Amanda Bullington
1a27ef68cb Upgrade to Realm 12 (#925)
* Update to realm 12

* Remove unused mocks to fix some tests

* Fix test by unmocking ObsEditProvider

* Fix more tests by removing mocks/changing when tests write to realm

* Remove mocks on ObsEdit component test and fix accessibility labels

* Fix hooks tests with realm

* Set test path for realm; finish fixing tests

* Small tweak

* Upgrade realm/react library

* Migrate schema
2023-11-22 13:01:59 -08:00
Ken-ichi
e3eb739388 Suggestions nav fix (#833)
* Bugfix: navigation was broken when choosing a taxon on Suggestions
* Test for Suggestions navigation

The thorny part here was isolating the test Realm db. We should really have a
generalized strategy for this, but this works for this task.
2023-10-25 08:34:39 -07:00
Amanda Bullington
5456758f27 Move hooks into sharedHooks folder; reorganize Observations and models/ (#194)
* Rearrange hooks and observation component code
* Rename models/ to realmModels/ and use babel aliases

Closes #155

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-10-20 16:59:19 -07:00
Ken-ichi
c22d0fe79a Use RealmProvider (#183)
This attempts to remove the necessity of opening and closing Realm
connections, which can lead to stale connections and invalidated objects. I
did not try to remove direct access to realm from AuthenticatedService,
which exists outside of the component hierarchy and can't really access
context, but I think eventually we may want to bring all that functionality
within the component hierarchy so there really is only one Realm connection
in the app.

Probably still some bugs here. One major problem is that deleting the Realm
file does not seem to trigger a re-render of the RealmProvider. My workaround
was to delete all the data in RealmProvider connection to Realm before
deleting the file, but it seems kind of redundant.

Some other changes

* Updated react-native-image-resizer and worked around some regressions
* Needed to use Array.from on Realm collections in many places;
  map( o => o ) doesn't seem to work for creating POJOs from realm objects any more
* React Native Paper provider needs to be inside the Realm provider for any
  realm stuff to happen with rn paper modals
* Several workarounds for the fact that Realm objects don't behave like POJOs
* Added useApiToken hook (#158)
* Renamed the useUser hook to useRemoteUser, since that's what it was doing
2022-10-06 16:15:22 -07:00