Skip to content

feat(paginator): expose previousPageIndex inside PageEvent #10759

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

Merged

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Apr 8, 2018

  • Exposes the previous page index inside the object that is emitted by the page event.
  • Reworks the page event tests to use a spy rather than saving the last result to the test component.

Fixes #10758.

@crisbeto crisbeto requested a review from andrewseguin as a code owner April 8, 2018 12:31
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Apr 8, 2018
@crisbeto crisbeto force-pushed the 10758/paginator-prev-page-index branch 2 times, most recently from bd025ea to 45cd2a1 Compare April 8, 2018 15:07
@lacolaco
Copy link
Contributor

lacolaco commented Apr 8, 2018

I'm not sure it would be related to that, but the trigger which emits page event is not only a change of index but includes page size change.
How about previousPage: { size, index } ?

Or, just an idea, following core's SimpleChange interface;

{
  previousPage: { size, index },
  currentPage:  { size, index },
  firstChange: boolean
  isFirstChange(): boolean
}

@crisbeto
Copy link
Member Author

crisbeto commented Apr 8, 2018

@lacolaco I was trying to avoid a breaking API change. We can reconsider changing up the interface in the next major version.

@lacolaco
Copy link
Contributor

lacolaco commented Apr 8, 2018

@crisbeto You're right. I'm wondering ain't there a way to solve it without BCs. Thanks.

@andrewseguin andrewseguin added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Apr 20, 2018
@mmalerba mmalerba added the target: minor This PR is targeted for the next minor release label Apr 20, 2018
@andrewseguin
Copy link
Contributor

I'm finding that many internal Google tests are failing because sometimes users create their own PageEvent (e.g. as an initial event on their pagination stream).

Would it make more sense to mark this field as optional to avoid a breaking change, as well as eliminate the need for such use cases to define a previous page index?

* Exposes the previous page index inside the object that is emitted by the `page` event.
* Reworks the `page` event tests to use a spy rather than saving the last result to the test component.

Fixes angular#10758.
@crisbeto crisbeto force-pushed the 10758/paginator-prev-page-index branch from 45cd2a1 to bec262f Compare April 24, 2018 22:12
@crisbeto
Copy link
Member Author

I've made it optional with a target to make it required in 7.0 @andrewseguin. Otherwise, I'm not sure whether we can eliminate the need for this property completely, e.g. I can see it coming in handy if we add the ability to jump to a page.

@andrewseguin andrewseguin merged commit 85039ca into angular:master Apr 25, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Paginator] Provide previous page information for PageEvent
5 participants