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

Add pagination #53

Closed
wants to merge 1 commit into from
Closed

Add pagination #53

wants to merge 1 commit into from

Conversation

nhunzaker
Copy link
Contributor

This commit adds pagination to ArsArsenal. It breaks up the data
fetcher and URL building options to make URL building clearer and
adds logic ot watch the last item in a list to trigger a new page
of data.

I need some way of identicating that pagination is done. In a
follow-up commit, I'd like to add a new option for "Pagination is
done". It would be nice to reduce configuration of this to be bear
minimum.

@@ -66,6 +66,7 @@
"dependencies": {
"classnames": "~2.2.6",
"lodash.sortby": "^4.7.0",
"query-string": "^6.2.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ArsArsenal will build a query for you. You just have to return an object from the new listQuery option

@@ -45,15 +46,15 @@ class TableView extends React.Component<Props, State> {
return Array.isArray(picked) ? picked.indexOf(id) >= 0 : id === picked
}

renderRow(item: Record, index: number) {
renderRow(item: Record, index: number, list) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, this is gonna break TS.

Copy link

@solomonhawk solomonhawk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@@ -17,8 +19,13 @@ interface Props {
picked: Array<string | number>
}

function getAnimationDelay(index) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔪 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

let outer = container.getBoundingClientRect()
let inner = nextChild.getBoundingClientRect()

if (inner.top < outer.bottom + outer.height * 0.5) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a simpler and perhaps more performant way to do this using scrollTop and scrollHeight? The answer may be no but I wanted to ask.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can give it another shot. I really strugged with this.

render: state => null
}

static getDerivedStateFromProps(props: Props, lastState: State) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat.

This commit adds pagination to ArsArsenal. It breaks up the data
fetcher and URL building options to make URL building clearer and
adds logic ot watch the last item in a list to trigger a new page
of data.

I need some way of identicating that pagination is done. In a
follow-up commit, I'd like to add a new option for "Pagination is
done". It would be nice to reduce configuration of this to be bear
minimum.
@nhunzaker
Copy link
Contributor Author

Types were a wreck. Fixed. I'll send some follow-up PRs to this branch, I still need to add a way to tell the pagination to stop.

@nhunzaker nhunzaker closed this Oct 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants