Skip to content

Commit

Permalink
increase perf on multiple rendering
Browse files Browse the repository at this point in the history
Instead of using proos.multiples on template, created a multiples.data object that get first the props, and use this reactive component scope to render template to increase perf
  • Loading branch information
syrk4web committed Jul 12, 2024
1 parent 8b17e99 commit 540ecfd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/client/vite/src/components/Forms/Group/Multiple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ const props = defineProps({
});
const multiples = reactive({
// Store value of multiple group
// By default, all multiples are invisible
// Store props.multiples on multiples.data and then use multiples.data to render increase performance
data: props.multiples,
invisible: [],
toDelete: [],
});
Expand Down Expand Up @@ -245,7 +245,7 @@ function delGroup(group, multName, groupName) {
</script>

<template>
<template :key="multName" v-for="(multObj, multName, id) in props.multiples">
<template :key="multName" v-for="(multObj, multName, id) in multiples.data">
<Container
data-is="multiple"
class="layout-settings-multiple"
Expand All @@ -262,12 +262,13 @@ function delGroup(group, multName, groupName) {

<template
:key="groupId"
v-for="(group, groupName, groupId) in props.multiples[multName]"
v-for="(group, groupName, groupId) in multiples.data[multName]"
>
<Container
data-group="multiple"
:data-group-name="groupName"
:data-mult-name="multName"
:data-plugin-name="multName"
class="layout-settings-multiple-group"
:aria-hidden="multiples.invisible.includes(`${multName}${id}`)"
v-show="
Expand Down

0 comments on commit 540ecfd

Please sign in to comment.