Avoid creating new function every iteration of array.map

This commit is contained in:
Andrew Kingston 2024-10-31 12:33:07 +00:00
parent afbec934f3
commit b9ba76f639
No known key found for this signature in database
1 changed files with 2 additions and 1 deletions

View File

@ -62,7 +62,8 @@
export const getAdditionalDataContext = () => { export const getAdditionalDataContext = () => {
const gridContext = grid?.getContext() const gridContext = grid?.getContext()
const rows = get(gridContext?.rows) || [] const rows = get(gridContext?.rows) || []
const cleaned = rows.map(gridContext?.rows.actions.cleanRow || (x => x)) const clean = gridContext?.rows.actions.cleanRow || (x => x)
const cleaned = rows.map(clean)
const goldenRow = generateGoldenSample(cleaned) const goldenRow = generateGoldenSample(cleaned)
const id = get(component).id const id = get(component).id
return { return {