-
Notifications
You must be signed in to change notification settings - Fork 41
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
Unhandled exception from updateStickyRows with patched Array prototype #2
Comments
@magnusbakken This does not sound right... How did you patch the array prototype? Did you use |
I'm sorry, I should've been more explicit about what I meant by patching the prototype. No, I haven't been using Object.defineProperty. I can see that doing so solves the problem, and will rewrite my own prototype overrides to set enumerable to false. Thanks for the tip! However I would still recommend using |
@magnusbakken I will wait with this for now, not sure how to tackle this because I don't think this should be an issue for 99% of the users. If I see this come up again, I'll see how we can address the issue. While it looks like a minor patch there are several points in mind:
I understand that while patching is not common and not recommended, it might still happen here and there, however, I believe that most prototype patches done by 3rd party libraries are done using Btw, even if a 3rd party lib has done this the wrong way you can always fix that by overriding the property assignment with a new one using |
No worries. I agree it's not a very important thing, and the issue actually inspired me to simply get rid of all the array prototype patching in my own project, so some good came of this. |
If you've patched the Array prototype in your project (not a great idea, I know), there are a couple of places in the project where the code accidentally includes the fields added to the prototype in iterations. This causes an exception from the updateStickyRows function in virtual-scroll/utils.ts. The code looks like this:
Since
rows
andstickyState
are both arrays, any method added to the Array prototype will be included in the iteration, andif (stickyState[i])
will return true as well. Then it fails when you dorow.style[type] = ...
, since the row variable is actually some random function object.There's a similar line in the file extracted-code-group.ts.
The easiest fix is to use
for (let i = 0; i < rows.length; i++)
instead.The text was updated successfully, but these errors were encountered: