Skip to content

Commit

Permalink
need to fangle context in case select options ever starts to change it
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Jan 26, 2024
1 parent 25899b4 commit 3cff63f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions ee/frontend/mobile-replay/transformer/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,19 +442,23 @@ function makeSelectElement(
children: serializedNodeWithId[],
context: ConversionContext
): ConversionResult<serializedNodeWithId> | null {
const selectOptions: serializedNodeWithId[] = []
if (wireframe.options) {
let optionContext = context
for (let i = 0; i < wireframe.options.length; i++) {
const option = wireframe.options[i]
const conversion = makeSelectOptionElement(option, wireframe.value === option, optionContext)
selectOptions.push(conversion.result)
optionContext = conversion.context
}
}
return {
result: {
type: NodeType.Element,
tagName: 'select',
attributes: inputAttributes(wireframe),
id: wireframe.id,
childNodes: [
...// TODO this won't work once we're editing the context
(wireframe.options?.map(
(option) => makeSelectOptionElement(option, wireframe.value === option, context).result
) || []),
...children,
],
childNodes: [...selectOptions, ...children],
},
context,
}
Expand Down

0 comments on commit 3cff63f

Please sign in to comment.