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

Change behavior of relayStylePagination merge function #9803

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

srmagura
Copy link

@srmagura srmagura commented Jun 9, 2022

Fixes #9802. See the issue for the actual vs. expected behavior before this patch.

I have tested this change in my real application and it fixed the problem I was experiencing.

Edit: After thinking about this more, the issue is less clearcut than I thought. Still, I believe the new behavior of merge is more correct. I added a long comment above relayStylePagination that explains why this is a tricky issue and why I think replacing the existing edges is the more-correct behavior.

Would this be considered a breaking change? In one sense, it is definitely a breaking change. In another sense, it makes the function behave more correctly, and any bug fix can be construed as a breaking change if people relied on the buggy behavior.

Checklist:

  • If this PR is a new feature, please reference an issue where a consensus about the design was reached (not necessary for small changes)
  • Make sure all of the significant new logic is covered by tests

@apollo-cla
Copy link

@srmagura: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

@srmagura
Copy link
Author

srmagura commented Jun 9, 2022

CI seems to have failed on something unrelated to my changes... maybe a flaky test? Everything was passing locally.

@jpvajda jpvajda added the 🏓 awaiting-team-response requires input from the apollo team label Jun 9, 2022
@jpvajda jpvajda requested a review from benjamn June 9, 2022 15:17
@srmagura srmagura marked this pull request as draft June 9, 2022 16:15
@srmagura
Copy link
Author

srmagura commented Jun 9, 2022

Converting to draft since, I think this bug also affects pagination with before and I did not fix that case. Will do it soon.

It now replaces existing edges when it receives an unknown cursor.
@srmagura srmagura force-pushed the fix-relay-style-pagination-after branch from f159f66 to edb5c38 Compare June 9, 2022 18:08
@srmagura
Copy link
Author

srmagura commented Jun 9, 2022

OK, this is ready for review. I also updated the description of the PR.

@srmagura srmagura marked this pull request as ready for review June 9, 2022 18:12
@srmagura srmagura changed the title Fix relayStylePagination bug when using after Change behavior of relayStylePagination merge function Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏓 awaiting-team-response requires input from the apollo team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

relayStylePagination concatenates edges when a query using after is repeated
3 participants