Skip to content

CCM-13495: update render#877

Open
alexnuttall wants to merge 449 commits intomainfrom
feature/CCM-13495-update-render
Open

CCM-13495: update render#877
alexnuttall wants to merge 449 commits intomainfrom
feature/CCM-13495-update-render

Conversation

@alexnuttall
Copy link
Contributor

@alexnuttall alexnuttall commented Mar 12, 2026

Description

  • server action to initiate personalised renders
  • per-tab polling mechanism
  • disable buttons during polling

I removed the use-letter-template-poll hook since it was tightly coupled to the component which uses it (PollLetterRender) and inlined the logic.

Other changes

As requested by @emmagifford, changed the invalid markers 'issues' to match the original markers as closely as possible: {d.invalid!} instead of invalid!.

Fixed a bug with the initial render where markers without a d. prefix would get reconstructed and rendered with the prefix.

Context

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming
  • If I have used the 'skip-trivy-package' label I have done so responsibly and in the knowledge that this is being fixed as part of a separate ticket/PR.

Sensitive Information Declaration

To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

@alexnuttall alexnuttall requested review from a team as code owners March 12, 2026 16:59

export async function generateLetterProof(
templateId: string,
lockNumber: number,
Copy link
Contributor

Choose a reason for hiding this comment

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

it may become clear as I review but why do we need to lock number to generate the proof?

Copy link
Contributor Author

@alexnuttall alexnuttall Mar 13, 2026

Choose a reason for hiding this comment

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

Multiple users could be generating proofs at once. To avoid confusion about whether the preview was actually initiated by the user's own request, I thought it was best to be as defensive as possible here

fields: Object.fromEntries([
...customPersonalisationFields.map((f) => [
f,
`${PERSONALISATION_FORMDATA_PREFIX}${f}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

how come we need the prefix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To avoid the possibility that someone would use 'lockNumber', 'systemPersonalisationPackId' etc. as a custom field name in their template, and we would overwrite the values. The form data is a flat object, so we need prefix namespacing for this ideally

personalisationParameters?.[f] ?? '',
]),
['__systemPersonalisationPackId', systemPersonalisationPackId ?? ''],
['systemPersonalisationPackId', systemPersonalisationPackId ?? ''],
Copy link
Contributor

Choose a reason for hiding this comment

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

not particularly related to your current ticket but this was something I was wondering about in my ticket - this is the ID for the test recipient field right?
has this ID come from somewhere? does it have to be this specifically? is "pack" referring to the PDS data or something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the field name on the frontend - it corresponds to a field on the render object in the database.

I called it a 'pack' ID because it idenfifies a set of example data: nhsNumber, address lines, name etc.

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.

4 participants