Skip to content
This repository was archived by the owner on Nov 5, 2023. It is now read-only.

Commit a13e411

Browse files
authored
fix: sharing nodes states (#227) (#230)
1 parent d586fb2 commit a13e411

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/Grid.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
<slot name="probe" />
1515
</div>
1616

17-
<template v-for="(internalItem, index) in buffer" :key="index">
17+
<template
18+
v-for="internalItem in buffer"
19+
:key="keyPrefix + '.' + internalItem.index"
20+
>
1821
<slot
1922
v-if="internalItem.value === undefined"
2023
name="placeholder"
@@ -39,6 +42,7 @@ import {
3942
PropType,
4043
ref,
4144
computed,
45+
watch,
4246
StyleValue,
4347
} from "vue";
4448
import {
@@ -89,8 +93,8 @@ export default defineComponent({
8993
type: String as PropType<"smooth" | "auto">,
9094
required: false,
9195
default: "smooth",
92-
validator: (value: string) => ["smooth", "auto"].includes(value)
93-
}
96+
validator: (value: string) => ["smooth", "auto"].includes(value),
97+
},
9498
},
9599
setup(props) {
96100
// template refs
@@ -136,11 +140,19 @@ export default defineComponent({
136140
])
137141
);
138142
143+
const keyPrefix = ref<string>("");
144+
watch(
145+
() => props.pageProvider,
146+
() => (keyPrefix.value = String(new Date().getTime())),
147+
{ immediate: true }
148+
);
149+
139150
return {
140151
rootRef,
141152
probeRef,
142153
buffer: useObservable(buffer$),
143154
rootStyles,
155+
keyPrefix,
144156
};
145157
},
146158
});

0 commit comments

Comments
 (0)