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

Commit

Permalink
fix: sharing nodes states (#227) (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
zumm committed Jun 4, 2022
1 parent d586fb2 commit a13e411
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/Grid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
<slot name="probe" />
</div>

<template v-for="(internalItem, index) in buffer" :key="index">
<template
v-for="internalItem in buffer"
:key="keyPrefix + '.' + internalItem.index"
>
<slot
v-if="internalItem.value === undefined"
name="placeholder"
Expand All @@ -39,6 +42,7 @@ import {
PropType,
ref,
computed,
watch,
StyleValue,
} from "vue";
import {
Expand Down Expand Up @@ -89,8 +93,8 @@ export default defineComponent({
type: String as PropType<"smooth" | "auto">,
required: false,
default: "smooth",
validator: (value: string) => ["smooth", "auto"].includes(value)
}
validator: (value: string) => ["smooth", "auto"].includes(value),
},
},
setup(props) {
// template refs
Expand Down Expand Up @@ -136,11 +140,19 @@ export default defineComponent({
])
);
const keyPrefix = ref<string>("");
watch(
() => props.pageProvider,
() => (keyPrefix.value = String(new Date().getTime())),
{ immediate: true }
);
return {
rootRef,
probeRef,
buffer: useObservable(buffer$),
rootStyles,
keyPrefix,
};
},
});
Expand Down

0 comments on commit a13e411

Please sign in to comment.