kamilkp / angular-vs-repeat

Virtual Scroll for AngularJS ngRepeat directive
http://kamilkp.github.io/angular-vs-repeat/
MIT License
818 stars 228 forks source link

size mismatch #202

Open defields923 opened 6 years ago

defields923 commented 6 years ago

I am having an issue since I upgraded from version 1.x to the latest. I have a list of elements all the same size within a ul that has a height of calc(100% - 31px). vs-repeat appears to be working, but I get that size mismatch error in the console, and many more are logged when I scroll. I tried adjusting the size option like so 'vs-repeat="{size: ...}"' to try and match the expected size, but I can only get as close as .000000001... to it no matter how much I try.

Was this an issue in the earlier version that just wasn't logged? What should I do to correct this, or is there at least a way of turning the logging off?

XueDong369 commented 6 years ago

I have the same problem with you! vsRepeat: size mismatch. Expected size 0px whereas actual size is 287px. Fix vsSize on element: <ul class=​"common-list-content" vs-repeat=​"{size:​ 36}​">​…​</ul>​

tje3d commented 6 years ago

You cant get rid of size mismatch, because if you set fixed size for your vs-repeat, you always have this warning, and if you don't set it, You don't have any scroll ( because the size of vs-repeat should not be same as sum of all elements height )

Any suggestion?

Edit

Whoops! i've upgraded to 2.0.9 and there is no problem any more, My markup:

<div class="overview vs-repeat-custom-scroll" vs-repeat> <!-- style="height: calc(100%); overflow: auto;" -->
    <div ng-repeat="group in groups | groupsList:groupsFilter:searchGroup" ng-class="{conv_selected: group.active}" ng-click="selectGroup(group)">
        <!-- ... -->
    </div>
 </div>
matortheeternal commented 6 years ago

I've experienced this issue on v1.1.11 as well as v2.0.9. I tried setting autoresize to true in the vs-repeat attribute options, but this did not fix the issue. Hardcoding a size does not make sense for my application where the window is resizable. My temporary solution is to downgrade back to v1.1.7. The size should just be computed based on the element's size by default like it was in v1.1.7, without requiring any dirty CSS workarounds like height: calc(100%).

XueDong369 commented 6 years ago

I am using v2.0.9 now, but this problem always not fixed yet!

tje3d commented 6 years ago

My problems is when i apply a filter to my ng-repeat, and the height of my items goes lower than vs-repeat height, i always have size mismatch warning. a hackfix is to calculate vs-repeat size when a filter applies but this is not the correct way.

icorne commented 6 years ago

I also get this issue, and when using the latch option, it's complaining about the wrong size as well, als the size should be a lot smaller

XueDong369 commented 6 years ago

@tje3d But it will cause the performance problem if the warning log always repeat ...

tje3d commented 6 years ago

@XueDong369 please check my pull request #206 it will prevent warning when there is no overflow scroll

XueDong369 commented 6 years ago

@tje3d Yes, I've changed the local code to #206 temporarily, then it won't console the warning info. Thanks! But, my project will run in Docker and it will run 'bower install' in Docker every time when I deploy it. I hope #206 will be merged ASAP. ~_~

tcrite commented 6 years ago

I had this same issue. Fixed it by inspecting every element in row and taking into account margins. Also had an inner element whose margin expanded pass the parent container causing the calculated size to be off.

tcrite commented 6 years ago

also, hiding the warning is just a mask...the underlying issue of the size being off will still end up in performance issues.

juanjmunozgonzalez commented 6 years ago

Hi, I get the same warning message and, what it is more relevant for IE11 (I'm forced to support it) the items are not rendered if I drag the scroll to the bottom. This only happens if I don't configure the item size, if I fix the item size, everything works but the performance gets worse, I experiment some glitches when I drag the scroll

DanielRuf commented 5 years ago

Any news?

ibrychgo commented 5 years ago

Same here. Getting this on list of md-cards (angularjs material). Was hoping for an easier solution to md-virtual-repeat.

erceth commented 3 years ago

I was able to work around the warning spam by removing the margin from my list elements. I think it was due to the fact that child margin doesn't affect parent height (https://stackoverflow.com/q/27829250/3038518). Perhaps a future fix for this bug would involve that information somehow.

lslee714 commented 2 years ago

Love 3 year old issues

kerryj89 commented 2 years ago

My previous comment (since deleted) was a false positive, but I am able to hide the warnings with the below snippet. I'm not well versed in AngularJS but piecing together some knowledge I was able to override (set?) sizeMismatchWarningsSilenced to true via decorator. I tried the more common way to config with angular.module('whatever', ['vs-repeat']).config(['vsRepeatConfig', function(vsRepeatConfig) {...}) but couldn't get it to work. Maybe someone more knowledgeable in AngularJS can see the error in my way.

angular.module('whatever', ['vs-repeat'])
    .config(['$provide', function($provide) {
        $provide.decorator('vsRepeatConfig', function($delegate) {
            return {
                ...$delegate,
                sizeMismatchWarningsSilenced: true
            };
        });
    }])