Closed jordaaash closed 7 years ago
I'm currently testing a build of this in my isomorphic application, substituting it in for the code from #15
I just noticed I'm actually using initialVisibleItems
instead of initialVisibleItemCount
. The latter is more explicit, but is definitely lengthy.
This looks great, although I would definitely prefer the more explicit initialVisibleItemCount
property name. We could probably shorten it to initialItemCount
if you'd prefer.
initialItemCount
sounds good to me (especially since they're not inherently visible, just rendered). Unfortunately, there are actually some problems with this implementation that I started resolving but didn't finish this weekend. I'll update the PR soon, just got busy with a project temporarily.
Sounds good; take your time. I've been busy myself and neglecting this project as it is =/
Haha it happens. I'm using the version from #15 with initialItems
already in production, so I just need to refactor a bit.
Any update with this? Server rendering is a priority for me as well.
@jordansexton sorry to bug again--I'm curious if you're still using #15 in production? To save some time I'm going to fork off that and see how it goes.
@quicksnap No worries, and sorry for the absentee PR here. I've just been swamped with work...
I do use this in production and have for the last few months. I also merged the latest from here into my fork's master just now to update it.
I will still revise this in line with @developerdizzle's desire to have an initialItem
count rather than an array, it's just taking me a while to get around to it.
SSR works by setting firstItemIndex
/lastItemIndex
now, so I'm closing this. I can share my specific implementation (which is based on a heavily cut down version of this library) if desired.
@jordansexton I'd love to see it, at least for my own learning purposes! Also - are you using v2 in production? If so, I'm curious how the new HOC convention has been for you, compared to v1.
@developerdizzle This is our full implementation (in production @ https://stylisted.com/stylists).
https://gist.github.com/jordansexton/10cc469c2dbd872585c45ebaf6053a8d
There's obviously a lot of extraneous stuff for immutability, isomorphism, performance optimization, and reuse of many of the mixins and other functions throughout our app.
Misc notes:
pointerEvents
is really useful to prevent jank on hover/touch events on the list, especially on mobile.Overall, I think the HOC architecture is great. I would love to try out a version that uses transformY
, which I haven't had time to figure out yet.
Nice, thanks for sharing this! I'm going to have to take some time to parse through it, but I do think things like disabling pointer-events
would be great to list as best practices in the README.
Sure thing. I got the idea from seatgeek/react-infinite, but just debounced so it doesn't set the component state and cause rerendering, or have to manage timeouts.
This is just a WIP refactoring of your branch. I tried to break it up if you want to cherry pick around it. This should fix the problems with isomorphic rendering I mentioned in the comments on #18 while also avoiding mismatching render checksums by only calling
getVirtualItems
first fromcomponentDidMount
.