-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
React-infinite fails with Cannot read property 'scrollShouldBeIgnored' of undefined
#234
Comments
Thanks for the report, I'll take a look! Likely related to refs or findDOMNode I think. |
@slmgc I believe this should be fixed in the latest preact ( |
@developit thanks! I'll test it today. |
@developit sadly, this issue is still reproducible :/ |
Ah, darn. I'll do a better job of reproducing locally, sorry! |
@developit do you need any help with repro? |
I should be alright. I really do wish one of the various bin sites (webpackbin, esnextb.in, jsbin, etc) would add support for module import aliasing. I've got an open issue on webpackbin for it. That would make these library integration repros nice and easy! |
@developit can replicate issue whenever the Infinite component properties elementHeight exceeds containerHeight for all initially loaded children. So something is causing the component to disappear when scroll bar get activated during the initial load. Played with another sample in Preact (works fine) which dynamically loaded 1000+ elements in 2sec intervals, but the initially loaded data did not exceed the containerHeight. Hope that makes sense. Can provide sample if needed. @slmgc Side note - should be loading styles like: Changed variable name for illustration purposes |
Do either of you happen to have a screenshot or log (w/ stack trace) of the error that gets thrown? Thanks |
If anyone still has a repro for this bug, I've just published |
@developit great, I'll check it! |
@developit sorry for the delay. Nope, still fails with the same error :( |
K, I'll keep digging haha |
Does this indicate a problem with Preact though, or React-infinite? .. or perhaps how either one is used? |
@jugimaster I think it's a minor compatibility issue with preact, because this library works fine with React. |
@slmgc Yeah, but there are lots and lots of libraries that were built to work with React, in more or less wacky ways. I don't see why Preact would need to adapt itself to all of them, especially considering a lot of them are bound to be kind of hacky. Preact's scope is narrower than React's anyway. I think it would benefit from limiting itself to being just another way to have Virtual DOM + Components, without worrying about React's massive ecosystem. |
@jugimaster I don't think it's a good idea limiting preact to being just another virtual DOM implementation. Preact rocks because you can switch from React to preact without any changes to the code. So, actually, it's a good idea to nail down all/most compatibility issues between React/preact/Inferno, etc. So anyone could reuse 99% of 3rd-party components. And I'm not sure to which whacky ways are you referring to? Is changing props, using life-cycle methods and manipulating DOM-elements considered hacky? I don't think so. |
Well, if Preact does exactly what it's supposed to, according to React's public API, wouldn't any library that only relies on the public API work too? Without looking into it, I'm guessing that in that case, if a library doesn't work with Preact, it relies on something that happens "behind" React's API, or some sort of implementation details. Maybe React does something in a certain order, or at a certain time, and somehow a library depends on that behaviour? -That's something Preact shouldn't concern itself with, especially when most tools/libs in the front-end world are solutions in search of problems that we'd all be better off not using anyway. |
@jugimaster No, the thing is, there are still compatibility issues left, that's why some libraries don't work as expected with preact. As an example, while working on react-hint and compatibility with Inferno, I with Dominic Gannaway (creator of Inferno) were able to find and resolve an issue with Inferno's |
Well, that's what I'm talking about. From my point of view, as long as Preact implements React's public API correctly, it has no "compatibility issues" at all. Libraries written against React (and its implementation details) may have compatibility issues with Preact :) Again, most tools/libs in the JavaScript ecosystem shouldn't be used at all. As a random example I saw today, why does (especially if Preact's author is doing his darndest to adapt Preact to any and all React libs) |
@jugimaster but it's not, that's why there are some libraries which aren't working with preact. And that's why it's a good idea to solve these compatibility issues. It helps to cover preact with more tests and makes it more stable/compatible. |
I doubt it :) But maybe I'm wrong! Either way, I hope @developit takes this thread into consideration. |
Hiya! Preact pretty accurately matches the React API, but it's possible there are implementation details from React that libraries then depend on. As an example, the timing of lifecycle events within the diff - a very subtle detail not covered in the React docs, but heavily relied on by libraries. I'm always happy to try to get to the bottom of compatibility issues, because doing so provides an opportunity to find bugs - libraries that might use React in slightly strange ways have a tendency to point them out more than idiomatic React-style code. That being said, we've been pretty good about trying to offload some of the crazier compatibility stuff into preact-compat, keeping Preact itself as light as possible. It's funny you mention preact-redux though - that's actually why it exists. react-redux is well-written but relies on some things Preact intentionally leaves out of its core - namely PropTypes and the silly TL;DR: weird uses help find edge cases, but fixes won't bloat. It's just a debugging exercise 😊 |
As I suspected! It just seems like a battle you can't win. Why would a lib rely on something like that, besides its authors not being into writing robust software? I didn't realize (.. "and soon we'll have stuff like |
It's definitely a cat-and-mouse game. Personally I just picked a few really high value (common) libs that were small enough to make depending on I do think it's worth making sure |
Well, at least you're off to a good start. Thanks for your time! :) |
Turns out this was actually ridiculously easy - The fix is released as |
@developit looks like we almost there :) It happens when the new data is loaded and appended to the existing one, like once in 10-15 times or so. |
@slmgc which version of preact? If possible, try with 7.x ( |
@developit |
yay! 7.0 will become mainline shortly, it's just in beta as the group of (technically) breaking changes gets solidified. |
Add preact/hooks alias in demo app
Hi @developit!
I was checking some functionality which is based on https://github.com/seatgeek/react-infinite. I wasn't able to check if
onLoad
triggers because it throws an error while scrolling. It's reproducible withpreact@5.1.0-beta.26
as well aspreact@5.3.0
:The text was updated successfully, but these errors were encountered: