Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecycleScroller has all items in dom #859

Open
4 tasks done
AlexKharenko opened this issue Mar 1, 2024 · 1 comment
Open
4 tasks done

RecycleScroller has all items in dom #859

AlexKharenko opened this issue Mar 1, 2024 · 1 comment

Comments

@AlexKharenko
Copy link

AlexKharenko commented Mar 1, 2024

Describe the bug

I use nuxt 3 and have registered components in plugin. Here is my component usage code:

<template>
  <RecycleScroller
    class="scroller"
    :items="items"
    :itemSize="TABLE_ROW_SIZE"
    :keyField="'id'"
    :prerender="30"
  >
    <template v-slot="{ item }">
      <div class="table-row">
        <div class="table-cell">{{ item.label }}</div>
      </div>
    </template>
  </RecycleScroller>
</template>

<script setup lang="ts">
const TABLE_ROW_SIZE = 40;

const items = useState(() => [] as any[]);

if (process.server)
  items.value = Array.from({ length: 1000 }, (_, i) => ({
    id: i,
    label: `Row ${i}`,
  }));
</script>

<style scoped>
.scroller {
  height: 100%;
}
</style>

</style>

I have all 1000 items rendered in the dom and also when it comes from ssr, it jumps to 40px height.

I've noticed that it pre-renders correct amount of data when it comes from ssr but then it renders all data when it mounted.

Reproduction

Code above. I use nuxt 3, vue-virtual-scroller: "^2.0.0-beta.8".

System Info

Ark browser.

Used Package Manager

npm

Validations

@ganya-qwe
Copy link

try to use pageMode prop, it worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants