Skip to content

Commit

Permalink
Added fix for reactive array props.
Browse files Browse the repository at this point in the history
  • Loading branch information
michielvandergeest committed Oct 30, 2024
1 parent f5bdb4a commit a03387e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/lib/codegenerator/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ let counter

export default function (templateObject = { children: [] }) {
const ctx = {
renderCode: ['const elms = []', 'let componentType', 'const rootComponent = component'],
renderCode: [
'const elms = []',
'let componentType',
'const rootComponent = component',
'let propData',
],
effectsCode: [],
context: { props: [], components: this.components },
}
Expand Down Expand Up @@ -213,10 +218,11 @@ const generateComponentCode = function (
options.component
)}`)
renderCode.push(`
props${counter}['${key.substring(1)}']= ${interpolate(
templateObject[key],
options.component
)}`)
propData = ${interpolate(templateObject[key], options.component)}
if (Array.isArray(propData) === true) {
propData = getRaw(propData).slice(0)
}
props${counter}['${key.substring(1)}'] = propData`)
} else {
renderCode.push(
`props${counter}['${key}'] = ${cast(templateObject[key], key, options.component)}`
Expand Down

0 comments on commit a03387e

Please sign in to comment.