Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/damikun/hcpaginationbug
This is bug example related to https://github.com/ChilliCream/hotchocolate/issues/2154
https://github.com/damikun/hcpaginationbug
Last synced: about 2 months ago
JSON representation
This is bug example related to https://github.com/ChilliCream/hotchocolate/issues/2154
- Host: GitHub
- URL: https://github.com/damikun/hcpaginationbug
- Owner: damikun
- Created: 2020-07-22T09:28:29.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T11:01:06.000Z (about 2 years ago)
- Last Synced: 2024-10-12T13:26:27.224Z (3 months ago)
- Language: C#
- Size: 15.9 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HCPaginationBug
This is bug reproduce repo... do not use this as example!Related to bug: https://github.com/ChilliCream/hotchocolate/issues/2154
Test data included! (in Program.cs)
## Bug location
After quick check it looks like problem in this part but im not sure... i did not debug it yet... It looks like going from + over 0 to - is not handled...
under: https://github.com/ChilliCream/hotchocolate/blob/a7b1f39c686d2d572f0ef61ff9d8c0ceea90b795/src/HotChocolate/Core/src/Types/Types/Relay/QueryableConnectionResolver.cs
```
int count = temp.Count();
int skip = count - last;
```
```
protected virtual IQueryable GetLastEdges(
IQueryable edges, int last,
ref int offset)
{
if (last < 0)
{
throw new ArgumentOutOfRangeException(nameof(last));
}IQueryable temp = edges;
int count = temp.Count();
int skip = count - last;if (skip > 1)
{
temp = temp.Skip(skip);
offset += count;
offset -= temp.Count();
}return temp;
}
```# To Run
```
1 Fetch to local Git
2 Run: dotnet restore
3 Run: dotnet wacth run
```
Info: Running on .Net5 Standard# Playground Query
```
query Users(
$first: PaginationAmount
$last: PaginationAmount
$after: String
$before: String
) {
users(
first: $first
after: $after
before: $before
last: $last
) {
pageInfo {
hasPreviousPage
hasNextPage
startCursor
endCursor
}
edges {
cursor
node {
iD
name
}
}
}
}
```
## Query Variables
```
{
"first": null,
"last": 1 ,
"before": "Mg==",
"after": null
}```
# SQLite database tableunder:
appDB.db| # | ID | Name |
|:-:|:--:|:-----:|
| 1 | 1 | user1 |
| 2 | 2 | user2 |
| 3 | 3 | user3 |
| 4 | 4 | user4 |# Packages:
```
runtime; build; native; contentfiles; analyzers; buildtransitive
all
```