Skip to content

feat: use template config for dynamic multiple choice#1582

Open
GrantDLS wants to merge 2 commits into
developfrom
use-template-config-for-dynamic-multi-v2
Open

feat: use template config for dynamic multiple choice#1582
GrantDLS wants to merge 2 commits into
developfrom
use-template-config-for-dynamic-multi-v2

Conversation

@GrantDLS

@GrantDLS GrantDLS commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Description

Currently, when a dynamic multiple choice question is added to a proposal, the template level config options are being ignored, i.e. only the configuration values set on the question are used.

This is because, the component uses a hook useGetDynamicMultipleChoiceOptions, which takes a question ID.

This PR solves this by obtaining the template ID, and if it is present, passes it to the GraphQL query getDynamicMultipleChoiceOptions. Within this function, getQuestionTemplateRelation is then called with the question ID and template ID. If the template ID isn't present, it falls back to using getQuestion with just the question ID parameter.

It's worth noting that I tried to solve this by passing the config that's available to the react component through to the backend, but since the http headers are stripped for security purposes, this wasn't a viable solution.

How Has This Been Tested

I've added a test to TemplateQueries.spec.ts that ensures it calls the getQuestionTemplateRelation method if the template ID is provided. I've also manually tested it.

Changes

The changes flow from the front end (getting the template ID from the context within the react component), through to the hook, and then the GraphQL query.

@GrantDLS GrantDLS changed the title Use template config for dynamic multi v2 feat: use template config for dynamic multiple choice Jun 16, 2026
@GrantDLS GrantDLS marked this pull request as ready for review June 16, 2026 11:25
@GrantDLS GrantDLS requested a review from a team as a code owner June 16, 2026 11:25
@GrantDLS GrantDLS requested review from Scott-James-Hurley and removed request for a team June 16, 2026 11:25
@GrantDLS GrantDLS added bug Something isn't working review: please labels Jun 16, 2026
}}
questionTemplateRelation={selectedQuestion}
callId={callId}
templateId={templateId}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this change has the same problem as the previous PR, are we sure we can't use the selectedQuestion object to pass the templateId in it? If you check out the SDK definition of the object it already contains three references to templateId.

I could be missing something if you think that isn't the right approach

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah you're right - it would be good if it was part of that question template relation but I couldn't quite figure it out. Hopefully when someone has time to review the PR they might have an idea on how to achieve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working review: please

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants