Commit Graph

4 Commits

Author SHA1 Message Date
Johannes Klein
49091f8fc4 Enable React Compiler (#3082)
* Update package.json

* Update package-lock.json

* Enable plugin

* Update package.json

* Update package-lock.json

* Update .eslintrc.js

* Create a new object instead of mutating the existing one

* Update SoundRecorder.js

* Do not mutate prop directly

* Do not mutate store value directly

* Disable compiler for zoom hook

Because it uses reanimated logic, and previous work laid out we should specifically disregard a rule of react here, unsure what to do here for now.

* Move array for tracking results into component

* Disable compiler for StandardCamera

* Do not mutate store value directly

* Disable compiler for FullPageWebView

* Do not mutate route param

* Remove unnecessary check if state is true before setting it to false

* Fix: user might be undefined

* Update reanimated usage with new compiler compliant API

* Fix: taxon might be undefined

* Fix: taxon might be undefined

* Fix: common pitfall of trying to render text outside of Text component

* Update interface

* Add package override

* Update package-lock.json

* Refactor updating of user preferences into User model

* Remove no memo directive from zoom

* Update file imports

* Migrate safeRealmWrite to TS

* Update interface and import path

* Update interface

* Refactor useLocaalObservation hook to not mutate return value of a function that should not be mutated

* Update tests to new return structure

* Remove useSafeRoute hook

We get the same information from error contexts and surrounding documents, and this hook was violating the rules of react by conditionally calling another hook.

* Use optional chaining

* Update TaxonNamesSetting.test.js

* Fix: use optional chaining

* Extend on RNTLs renderHook instead of re-implementing

* Remove unnecessary mock

* Remove unnecessary mock

* Remove unecessary mock

* Remove trailing spaces
2025-09-01 17:06:51 +02:00
Amanda Bullington
bd6bed71ce Simplify bottom sheet component; don't use onChange to close (#2226) 2024-10-03 21:36:17 -07:00
Ken-ichi
591d6dc0e5 DQA voting status (#1757)
* Readability / cleanup updates for DQA
* Moved from unnecessary use of useMutation to useQuery for fetching metrics
* Log API errors
* Avoid warnings in tests about updates outside of act
* Update header in DQA after vote changes quality grade

Closes #1504
2024-07-03 10:08:47 -07:00
Johannes Klein
5553719a2f Community Taxon improvement DQA (#1291)
* Restyle community taxon section

* Use fave/unfave mutation in case of need_id metric

* Add votes field to Observation

* Change useIsConnected to TS

* Refactor fetching of remote observation into hook

Also includes the code to update local copy of a user's own observation

* Use const as key instead of string

* Remove unused prop

* Only send obs uuid to DQA

* Get obs in DQA container

* Rebuild object that is to check as it was send in nav params

* Refactor qualityGrade

* Refactor set to not loading state

* Update test to reflect fetching of obs

* Refactor too long lines

* Refetch remote observation after success in adding/removing vote

* Change qualitcMetrics to make use of observation.votes as well

Also refactored the object structure to use more efficient and performant filtering and finding in child components.

* Only use data slice for DQA buttons

* Refactor DQAButtons to only work with data slice relevant to that metric

* Special case for needs_id metric

* Also show loading indicator when fetching remote obs

* Add TODO

* Check only for vote of this user

* Optional chaining for user id

* Update test

* Enable fetching of remote if local is falsy

* Invalidate query on mutation

* Only set loading to false after refetch is finished

* Split up DQA test into unit tests and integration tests

* Use factory for mock user

* Add needs_id DQAVoteButtons unit test

* Revert hook to js

* Check for observation before using it

* Undo code style changes

* Remove unused value

* Refactor faves to be derived from votes

* Refactor needs_id interaction into standalone fcts

* Code style
2024-03-22 21:57:28 +01:00