Skip to content

LF-5214: RTK Query API layer and i18n#4092

Open
litefarm-pr-bot wants to merge 1 commit intointegrationfrom
LF-5214-rtk-query-api-layer-and-i18n
Open

LF-5214: RTK Query API layer and i18n#4092
litefarm-pr-bot wants to merge 1 commit intointegrationfrom
LF-5214-rtk-query-api-layer-and-i18n

Conversation

@litefarm-pr-bot
Copy link
Collaborator

Description

This PR establishes the data layer foundation that all other Farm Notes UI PRs depend on. The farm_note and farm_notes_read routes did not previously exist in the frontend at all — this adds the URL constants, TypeScript types, and RTK Query endpoint definitions that downstream components will consume directly as hooks.

The two RTK Query API files follow the marketDirectoryInfoApi.ts / supportTicketApi.ts patterns already in use: farmNoteApi.ts injects four endpoints (GET list, POST with optional FormData file upload, PATCH by ID, DELETE by ID) and farmNotesReadApi.ts injects a GET and a no-argument PATCH. The FarmNote type includes a to_sync?: boolean client-only field (never returned by the API) which future offline-optimistic PRs will use to render a "Pending sync" indicator. English locale strings are added to translation.json (UI labels) and message.json (snackbar messages) and sorted via pnpm i18n.

No saga, no Redux slice — RTK Query handles caching and invalidation entirely. onQueryStarted optimistic updates for offline support are out of scope here and will be added in the offline PR.

Jira link: https://lite-farm.atlassian.net/browse/LF-5214

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Passes test case
  • UI components visually reviewed on desktop view
  • UI components visually reviewed on mobile view
  • Other (please explain)

Data layer only — no UI rendered. TypeScript types and RTK Query endpoint definitions reviewed in source. pnpm i18n run to confirm locale keys are valid and alphabetized. No local server running; visual review not applicable.

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • The precommit and linting ran successfully
  • I have added or updated language tags for text that's part of the UI
  • I have ordered translation keys alphabetically (optional: run pnpm i18n to help with this)
  • I have added the GNU General Public License to all new files

Adds the data layer foundation for the Farm Notes / noticeboard feature:
URL constants, TypeScript types, RTK Query endpoint definitions, and
English locale strings in translation.json and message.json.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@litefarm-pr-bot litefarm-pr-bot requested review from a team as code owners March 17, 2026 22:40
@litefarm-pr-bot litefarm-pr-bot requested review from SayakaOno and removed request for a team March 17, 2026 22:40
@@ -1,4 +1,5 @@
{
"{undefined}": "MISSING",
Copy link
Collaborator

@kathyavini kathyavini Mar 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, we do have this problem running pnpm i18n! I could add instructions to the agent to manually remove it, although it would be better to just fix. Do you happen to remember why this happens @SayakaOno?

Edit: I can whip up a little ticket as this kind of limited scope thing the bot is pretty good at. Update: PR is opened here: #4094

"WIDTH": "Watercourse width"
}
},
"FARM_NOTE": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure if I liked this pattern or not (strings separate) so I let it go through as a test. I thought maybe it would be easier to update CrowdIn this way?

But then the next agent automatically added the strings it needed for its PR, so one or the other will have to get deleted! Probably it's better to just keep strings with their UI elements.

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.

2 participants