Skip to content

Commit abd06e5

Browse files
committed
Prevent ID being set on list-based components temporarily
1 parent e74061f commit abd06e5

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/server/plugins/engine/components/ListFormComponent.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ export class ListFormComponent extends FormComponent {
125125
const selected = values.includes(item.value)
126126
const itemModel: ListItem = { ...item, selected }
127127

128+
if ('id' in itemModel) {
129+
delete itemModel.id
130+
}
131+
128132
if (item.description) {
129133
itemModel.hint = {
130134
text: item.description

src/server/plugins/engine/pageControllers/QuestionPageController.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,15 +443,13 @@ describe('QuestionPageController', () => {
443443
expect(filtered[1].model.label?.text).toBe('Select from the list')
444444
expect(filtered[1].model.items).toEqual([
445445
{
446-
id: expect.any(String),
447446
checked: false,
448447
condition: 'isBarnOwl',
449448
selected: false,
450449
text: 'Option 1',
451450
value: '1'
452451
},
453452
{
454-
id: expect.any(String),
455453
checked: false,
456454
condition: 'isBarnOwl',
457455
selected: false,
@@ -501,15 +499,13 @@ describe('QuestionPageController', () => {
501499
expect(filtered[1].model.label?.text).toBe('Select from the list')
502500
expect(filtered[1].model.items).toEqual([
503501
{
504-
id: expect.any(String),
505502
checked: false,
506503
condition: 'notBarnOwl',
507504
selected: false,
508505
text: 'Option 3',
509506
value: '3'
510507
},
511508
{
512-
id: expect.any(String),
513509
checked: false,
514510
condition: 'notBarnOwl',
515511
selected: false,

0 commit comments

Comments
 (0)