Skip to content

fix: align plugin prop types with the Capture app - #11

Merged
kabaros merged 1 commit into
mainfrom
fix/plugin-types-accuracy
Dec 3, 2026
Merged

kabaros merged 1 commit into
mainfrom
fix/plugin-types-accuracy

Conversation

@kabaros

@kabaros kabaros commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Why

Plugin.types.ts is the shape many developers copy, but it doesn't match what Capture passes to form field plugins (FormFieldPlugin.types.ts in capture-app).

Changes

  • Plugin.types.ts:
    • Add orgUnitId and viewMode.
    • Add code and attributes to the field metadata.
    • Remove id from the field metadata, because Capture strips it.
    • Remove options from setContextFieldValue, because Capture ignores it.
  • d2.config.js: set pluginType: 'CAPTURE_FORM_FIELD' (the new convention; Capture doesn't read it) and remove the "verify plugin type" TODO.
  • Update the README and the test mocks to match.

Testing

Tests pass. As before this change, you need to run d2-app-scripts i18n generate first.

Related PRs

Part of a set that makes DHIS2 plugins (Capture form field / enrollment / bulk data entry, Dashboard) easier to build, and brings the docs in line with what the host apps actually pass:

🤖 Generated with Claude Code

- Plugin.types.ts now matches the props Capture passes: add orgUnitId
  and viewMode, add code and attributes to field metadata, drop id
  (Capture strips it) and drop options from setContextFieldValue
  (Capture ignores it)
- use pluginType CAPTURE_FORM_FIELD and remove the "verify plugin type"
  todo

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kabaros
kabaros marked this pull request as ready for review December 3, 2026 08:08
@kabaros
kabaros merged commit b88f9df into main Dec 3, 2026
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