liveblog icon indicating copy to clipboard operation
liveblog copied to clipboard

Feature/load-more - Toggle lazy loading feature

Open cain opened this issue 6 years ago • 12 comments

liveblog-load-more-smaller

Ability to toggle a "load more" type pagination. Default is set to "page" type pagination, but can be changed in the config settings paginationType

cain avatar May 09 '18 07:05 cain

Rebased off 1.8.2 master.

cain avatar May 10 '18 05:05 cain

Still TODO:

  • Check the review above ^^^
  • Change jump-to-key-event to contain all previous pages for load more functionality

cain avatar May 11 '18 02:05 cain

Change jump-to-key-event to contain all previous pages for load more functionality

@cain what is the " jump-to-key-event" this part refer to as missing?

adamsilverstein avatar Jun 11 '18 17:06 adamsilverstein

@adamsilverstein So, when "jump-to-key-event" action is called, it will only load x number (entries per page) of entries before the desired "event". Ideally we want all entries before the event we are jumping to.

Eg. if the event is on page 3, load the first 2 pages PLUS the 3rd page, then scroll to event. Let me know if this doesnt make sense.

We pushed a feature to our local repo, but i havent pushed the code to github yet. Kind of tricky since we created a new endpoint to help deal with this. Ill push the code soon.

cain avatar Jun 11 '18 23:06 cain

@adamsilverstein Do you want to push your changes you made in your PR to this branch?

cain avatar Jun 11 '18 23:06 cain

Ideally we want all entries before the event we are jumping to.

So would this mean 'load more' would load all remaining entries vs. another page of entries?

Do you want to push your changes you made in your PR to this branch?

Sure, I'm not quite finished, I'll pull the changes back in here when I am.

I'm going to add logic to change the load more button into a spinner once you click it so you can tell something is happening (and to prevent clicking it twice). In addition, we are going to enable (via a filter) scroll detection that eliminates the Load More button entirely and instead lazy loads entries as your scroll approaches the bottom of the stream

adamsilverstein avatar Jun 12 '18 14:06 adamsilverstein

So would this mean 'load more' would load all remaining entries vs. another page of entries?

Sorry I'm confused by the question. The "load more" button just gets the next page of data. I'm trying to say that, when using the jumpToEvent action on load with the hash in the URL it makes sense to load all PREVIOUS entries to the event. The current jump to an event only loads the number of entries in that page.

Eg: if my URL is website.com/wp-liveblog/123123/#12 and we have 5 entries per page, on load we want every entry before id 12 correct? So we had to create a new endpoint to get page1, page2, page3 at once. I don't think this is an issue for you guys since you load 50 entries per page.

I'm going to add logic to change the load more button into a spinner once you click it so you can tell something is happening (and to prevent clicking it twice). In addition, we are going to enable (via a filter) scroll detection lazy loads entries as your scroll approaches the bottom of the stream

Sounds good! We aren't interested in the infinite scroll at the moment, but would be a good feature to have!

cain avatar Jun 12 '18 23:06 cain

The "load more" button just gets the next page of data. I'm trying to say that, when using the jumpToEvent action on load with the hash in the URL it makes sense to load all PREVIOUS entries to the event. The current jump to an event only loads the number of entries in that page.

Ah, ok - got it, i was confused.

adamsilverstein avatar Jun 13 '18 01:06 adamsilverstein

Any news on this?

fabianpimminger avatar May 23 '19 16:05 fabianpimminger

@fabianpimminger we implemented this feature for fivethirtyeaight's implementation, however I'm not sure these changes were ever merged upstream. Take a look at this PR for some details and in case you want to add the functionality to your site: https://github.com/paulschreiber/liveblog/pull/28

adamsilverstein avatar Jun 27 '19 13:06 adamsilverstein

Thx @adamsilverstein .. any chance this gets merged?

fabianpimminger avatar Jun 28 '19 06:06 fabianpimminger

I'm no longer supporting this, just need to get it tested and merged by an admin.

cain avatar Jun 28 '19 06:06 cain