-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
VirtualScroll Can't read property length of null #11439
Comments
@aggarwalankush |
Happened few times only. Don't know how to reproduce. Closing this as there are other important issues than this one. |
This happens for me after upgrading to ionic 3.
Issues can be prioritized I don't think you should have closed this just because other issues exist...
gets the exception every time for me. It happens If I change this around to use the async pipe too. The only fix is to change the first line to: which is not a great solution because I don't know how many times this pattern is used in my app and I'll probably miss one or two :/ |
@ADCJustinH I think you have a different issue, this time: |
@manucorporat Thanks for taking a look. I am indeed using 3.1.1 but the stack is slightly different:
and yes, the C in cordova is missing in the console output lol |
@manucorporat I am getting the similar error again but now for set property.
|
same here. I get:
after I updated from 2.2.0 to 3.3.0 |
@ADCJustinH Tried your workaround to change filteredCourses: ICourseResult[]=[]; but doesnt work either. |
Here are my tests using 3.4.2
Oh there is already a huuuge list: #8744 other libs
|
Getting this issue too. Tried this:
|
@manucorporat I believe the source of this particular bug is a race condition between requestAnimationFrame and ngOnDestroy. ngOnDestroy nulls out _nodes, _cells, _date, etc. at https://github.com/ionic-team/ionic/blob/master/src/components/virtual-scroll/virtual-scroll.ts#L819 but there are scheduled raf calls in renderVirtual and in _dom.read() / _dom.write() which might execute after ngOnDestroy has free'd those object properties. |
Getting this as well. Has anyone found a workaround? |
fixed! 88b2e83 |
I'm not so sure that commit fixes this bug. I still see the exact same use of, for example, data.topCell being accessed here: https://github.com/ionic-team/ionic/blob/88b2e8316dad5c504695405fa2199aacbea5b5d6/src/components/virtual-scroll/virtual-scroll.ts#L552 without any prior checks to verify data is not null. And I still see data being set to null here: https://github.com/ionic-team/ionic/blob/88b2e8316dad5c504695405fa2199aacbea5b5d6/src/components/virtual-scroll/virtual-scroll.ts#L820 without cancelling the scheduled requestAnimationFrame that wraps the aforementioned access of data.topCell. Maybe I'm missing something. @masimplo which of your code changes did you think addressed this bug? |
@Kevin-Hamilton I will have to check and get back to you as I can't remember from the top of my head. I do remember that this error was triggered in a couple situations, maybe yours is different. Are you starting with a null collection or nulling the collection at some other point? Maybe it is a good idea to cancelRaf on ngOnDestroy anyway for race conditions. Will see what I can do. Which ionic version are you using so I can create a bundle for you to try? |
I´m getting the same error "VirtualScroll Can't read property length of null" No resolution for this bug? |
I'm getting this error with just a simple test array: home-container.html home-container.ts
In this same home-container I am using an input array (received from an Observable from the parent container) and it works normally with *ngFor. With virtualScroll not even that simple testArray works. |
@UnderTheMoonspell |
@suryabhanbarai it didn't. The only element inside ion-list is
|
This issue has been automatically identified as an Ionic 3 issue. We recently moved Ionic 3 to its own repository. I am moving this issue to the repository for Ionic 3. Please track this issue over there. If I've made a mistake, and if this issue is still relevant to Ionic 4, please let the Ionic Framework team know! Thank you for using Ionic! |
Issue moved to: ionic-team/ionic-v3#279 |
Ionic version: (check one with "x")
[ ] 1.x
[ ] 2.x
[x] 3.x
I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
I got Null exception at https://github.com/driftyco/ionic/blob/master/src/components/virtual-scroll/virtual-scroll.ts#L601
Expected behavior:
Check for null before calling length function
Steps to reproduce:
Don't know how to reproduce. Got it only a few times.
Related code:
Other information:
Ionic info: (run
ionic info
from a terminal/cmd prompt and paste output below):The text was updated successfully, but these errors were encountered: