Skip to content
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

Merged
merged 9 commits into from
Oct 17, 2024
Merged

feat: offline-mode soil updates #2333

merged 9 commits into from
Oct 17, 2024

Conversation

tm-ruxandra
Copy link
Contributor

Description

Implement and unit test client-side versions of the four soil data mutations: updateSoilData, deleteSoilDataDepthInterval, updateSoilDataDepthInterval, and updateDepthDependentSoilData. 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

  • Corresponding issue has been opened
  • New tests added

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.

/**
* The soil data fields which are covered by the update action.
*/
export const SOIL_DATA_UPDATE_FIELDS = [
Copy link
Contributor Author

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 (
Copy link
Contributor Author

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.

@tm-ruxandra tm-ruxandra merged commit 72b2cb0 into main Oct 17, 2024
10 checks passed
@tm-ruxandra tm-ruxandra deleted the feat/local-soil-updates branch October 17, 2024 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Offline] Implement and test local soil data mutations
2 participants