Skip to content
Source
Sign inSign up
TanStack/virtual

fix(virtual-core): loosen approxEqual to allow 1px difference #995

Mergedpiecykmerged 2 commits intomain fromrefs/pull/995/headmerged by piecyk

piecykcommented

fixes #980

    1. 🦋 Changeset detected

      Latest commit: e538844fb87a09414284660ea3f3929b326cb83f

      The changes in this PR will be included in the next version bump.

      This PR includes changesets to release 7 packages
      NameType
      @tanstack/virtual-corePatch
      @tanstack/angular-virtualPatch
      @tanstack/lit-virtualPatch
      @tanstack/react-virtualPatch
      @tanstack/solid-virtualPatch
      @tanstack/svelte-virtualPatch
      @tanstack/vue-virtualPatch

      Not sure what this means? Click here to learn what changesets are.

      Click here if you're a maintainer who wants to add another changeset to this PR

    2. View your CI Pipeline Execution ↗ for commit e538844fb87a09414284660ea3f3929b326cb83f.

      CommandStatusDurationResult
      nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded2m 25sView ↗
      nx run-many --target=build --exclude=examples/**✅ Succeeded17sView ↗

      ☁️ Nx Cloud last updated this comment at 2025-05-05 17:33:20 UTC

    3. More templates

      @tanstack/angular-virtual

      npm i https://pkg.pr.new/@tanstack/angular-virtual@995

      @tanstack/lit-virtual

      npm i https://pkg.pr.new/@tanstack/lit-virtual@995

      @tanstack/solid-virtual

      npm i https://pkg.pr.new/@tanstack/solid-virtual@995

      @tanstack/react-virtual

      npm i https://pkg.pr.new/@tanstack/react-virtual@995

      @tanstack/virtual-core

      npm i https://pkg.pr.new/@tanstack/virtual-core@995

      @tanstack/svelte-virtual

      npm i https://pkg.pr.new/@tanstack/svelte-virtual@995

      @tanstack/vue-virtual

      npm i https://pkg.pr.new/@tanstack/vue-virtual@995

      commit: e538844

    4. piecyk merged this60719f6

    5. piecyk closed this

    6. packages/virtual-core/src/index.ts line 1005
      @@ -1010,5 +1001,5 @@
      10101001 const [latestOffset] = notUndefined(
      10111002 this.getOffsetForIndex(index, align),
      10121003 )
      1013-
      1014- if (!approxEqual(latestOffset, this.getScrollOffset())) {
      1004+ const currentScrollOffset = this.getScrollOffset()
      1005+ if (!approxEqual(latestOffset, currentScrollOffset)) {

      Looks like there still a chance to get infinite loop

      Do you have something specific in mind?

      I guess for any given scrollToIndex we want to set some kind of counter, and break recursion when this counter is reach some limit, kinda dead loop detector

    7. piecykreplied on packages/virtual-core/src/index.ts line 1005

      Do you have something specific in mind?

    8. ogonkov(GitHub profile, opens in a new tab)replied on packages/virtual-core/src/index.ts line 1005

      I guess for any given scrollToIndex we want to set some kind of counter, and break recursion when this counter is reach some limit, kinda dead loop detector

Sign in to join this conversation.