fxos-components/fastlist

Caching V2: Scrollable cached render

Closed this issue · 10 comments

Caching V2: Scrollable cached render

The tricky part of this feature is knowing when to update the cached height value. After discussion offline I'm favouring adding an addition method .complete().

When .complete() is called, we can assume that the user has finished mutating their list.model and that we can update any internal caches.

list.model = initialModel;

...

list.model = list.model.concat(newChunk);
list.model = list.model.concat(newChunk);
list.model = list.model.concat(newChunk);

list.complete();

When .complete() is called we:

  • Replace list.style.height with newly calculated height
  • Store the cached height in localStorage for next render

Calling .complete() is optional. It is a progressive enhancement that allows us to do more for the user internally.

We should not update any HTML caches when .complete() has been called as scroll position may have changed and we always want to cache the markup for the items at the top of the list.

I noticed that the cached render is not scrollable until the first chunk of real data arrives. Is this the intention?

Tried playing a bit with when we layerize and didn't find anything that was clearly better.
We initialize the list when the first chunk arrive then layerize right now. Which does makes sense in most use cases.

So scrolling is blocked until first chunk arrives. Aside from the time to first paint, are there risks to making the cached render scrollable?

We should close this bug if it is not a feature we intend to implement.

Don't think so.

On Tue, Sep 8, 2015 at 11:43 AM, Wilson Page notifications@github.com
wrote:

So scrolling is blocked until first chunk arrives. Aside from the time to
first paint, are there risks to making the cached render scrollable?


Reply to this email directly or view it on GitHub
#49 (comment)
.

Etienne Segonzac

I'm confused, do you want to do this or not?