NOTE: I am bit unsure about this issue. This issue might simply require reviewing the merging logic after the rest of #5529 is done. This issue might not actually require new code and simply only require testing.
When the editor combines templates from multiple grant givers, it currently deduplicates sections by title and keeps the first description it sees. Update the merge logic so matching fields are combined by name, metadata is reconciled predictably, and unrelated fields stay in source order.
Relevant source locations:
frontend-web/webclient/app/Grants/Editor.tsx (calculateNewApplication, parseIntoSections)
provider-integration/shared/pkg/accounting/grants.go (Templates)
core2/pkg/accounting/grants.go (grant application model)
The merge happens in calculateNewApplication, after each template string has been parsed into ApplicationSections. That is the place to change the deduplication and ordering rules before the editor state is rebuilt.
parseIntoSections already extracts title, description, limit, and row hints from the plain-text template. Reuse those values when combining sections so later templates do not silently lose metadata.
Success criteria:
- Sections with the same name merge into one field.
- Identical descriptions are shown once; differing descriptions are shown together.
- The most restrictive length and the largest row count are chosen.
- Distinct fields stay grouped by grant giver instead of being interleaved.
NOTE: I am bit unsure about this issue. This issue might simply require reviewing the merging logic after the rest of #5529 is done. This issue might not actually require new code and simply only require testing.
When the editor combines templates from multiple grant givers, it currently deduplicates sections by title and keeps the first description it sees. Update the merge logic so matching fields are combined by name, metadata is reconciled predictably, and unrelated fields stay in source order.
Relevant source locations:
frontend-web/webclient/app/Grants/Editor.tsx(calculateNewApplication,parseIntoSections)provider-integration/shared/pkg/accounting/grants.go(Templates)core2/pkg/accounting/grants.go(grant application model)The merge happens in
calculateNewApplication, after each template string has been parsed intoApplicationSections. That is the place to change the deduplication and ordering rules before the editor state is rebuilt.parseIntoSectionsalready extracts title, description, limit, and row hints from the plain-text template. Reuse those values when combining sections so later templates do not silently lose metadata.Success criteria: