Skip to content
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

Feature/load-more - Toggle lazy loading feature #442

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cain
Copy link
Contributor

@cain cain commented May 9, 2018

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
Copy link
Contributor Author

cain commented May 10, 2018

Rebased off 1.8.2 master.

@cain
Copy link
Contributor Author

cain commented May 11, 2018

Still TODO:

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

@adamsilverstein
Copy link

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 pushed a commit to paulschreiber/liveblog that referenced this pull request Jun 11, 2018
Based on Automattic#442

* add preventDefault to prevent admin form submission
* add a style to center the button
@cain
Copy link
Contributor Author

cain commented Jun 11, 2018

@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
Copy link
Contributor Author

cain commented Jun 11, 2018

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

@adamsilverstein
Copy link

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

@cain
Copy link
Contributor Author

cain commented Jun 12, 2018

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!

@adamsilverstein
Copy link

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.

@fabianpimminger
Copy link

Any news on this?

@adamsilverstein
Copy link

@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: paulschreiber#28

@fabianpimminger
Copy link

Thx @adamsilverstein .. any chance this gets merged?

@cain
Copy link
Contributor Author

cain commented Jun 28, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants