Skip to content

Fix pb-message boilerplate templates ignored by generic container #3156

Description

@salman2013

Summary

When inside a Problem Builder (or other StudioContainerWithNestedXBlocksMixin) container block, the "Add Component" buttons for pb-message variants (Message complete / incomplete / Max attempts) all create the same default block, ignoring the selected boilerplate template.
For detail look at this comment: #3058 (comment)

Root Cause

Two bugs in src/course-unit/add-component/AddComponent.tsx:

  1. Rendering — the default case button click handler called handleCreateNewXBlock(type) without forwarding firstTemplate?.boilerplateName.
  2. Handler — the default branch of handleCreateNewXBlock called handleCreateNewCourseXBlock(...) without boilerplate: moduleName, so the backend always used the default template.

Fix

  • Pass firstTemplate?.boilerplateName from the button onClick to handleCreateNewXBlock.
  • Forward it as boilerplate in the handleCreateNewCourseXBlock call inside the default handler branch.

Related

Activity

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

Metadata

Metadata

Assignees

Labels

bugReport of or fix for something that isn't working as intended

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions