-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: offline-mode soil updates #2333
Conversation
… on feature flag state
/** | ||
* The soil data fields which are covered by the update action. | ||
*/ | ||
export const SOIL_DATA_UPDATE_FIELDS = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am open to a better means of enumerating these fields in the future (via some sort of codegen?), but this was the best option that the other devs and I could come up with.
import * as localSoilData from 'terraso-mobile-client/model/soilId/actions/localSoilDataActions'; | ||
import {AppState} from 'terraso-mobile-client/store'; | ||
|
||
export const updateSoilDataThunk = async ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure if it makes more sense to just merge the thunk methods with the non-thunk methods -- I suspect that the separation isn't necessary, but somehow this felt cleaner to me.
Description
Implement and unit test client-side versions of the four soil data mutations:
updateSoilData
,deleteSoilDataDepthInterval
,updateSoilDataDepthInterval
, andupdateDepthDependentSoilData
. When the offline feature flag is turned on, the client will use the local logic rather than making graphQL calls, and the resulting data will be ingested by the redux state.Checklist
Related Issues
Fixes #2277
Verification steps
Open the app with the offline feature flag turned on. Verify that all soil data actions (editing site settings, depth intervals, taking readings etc) behave as expected.