angular-vs-repeat icon indicating copy to clipboard operation
angular-vs-repeat copied to clipboard

size mismatch

Open defields923 opened this issue 6 years ago • 17 comments

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?

defields923 avatar Apr 25 '18 16:04 defields923

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>​

XueDong369 avatar Apr 26 '18 02:04 XueDong369

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>

tje3d avatar Apr 26 '18 05:04 tje3d

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%).

matortheeternal avatar Apr 28 '18 19:04 matortheeternal

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

XueDong369 avatar Apr 30 '18 13:04 XueDong369

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.

tje3d avatar May 01 '18 06:05 tje3d

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

icorne avatar May 02 '18 11:05 icorne

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

XueDong369 avatar May 10 '18 06:05 XueDong369

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

tje3d avatar May 10 '18 06:05 tje3d

@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. ~_~

XueDong369 avatar May 19 '18 09:05 XueDong369

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 avatar Jul 03 '18 14:07 tcrite

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

tcrite avatar Jul 03 '18 14:07 tcrite

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

juanjmunozgonzalez avatar Jul 20 '18 10:07 juanjmunozgonzalez

Any news?

DanielRuf avatar Feb 20 '19 07:02 DanielRuf

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

ibrychgo avatar Feb 22 '19 20:02 ibrychgo

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.

erceth avatar Oct 07 '21 23:10 erceth

Love 3 year old issues

lslee714 avatar Jan 15 '22 16:01 lslee714

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
            };
        });
    }])

kerryj89 avatar Jun 01 '22 18:06 kerryj89