-
Notifications
You must be signed in to change notification settings - Fork 7
fix(pagination): keep the cursor and filters when fetching the next page #134
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
| use Platformsh\Cli\Service\PropertyFormatter; | ||
| use Platformsh\Cli\Service\Table; | ||
| use Platformsh\Cli\Util\OsUtil; | ||
| use Platformsh\Cli\Util\PaginationUtil; | ||
| use Platformsh\Client\Model\CentralizedPermissions\UserExtendedAccess; | ||
| use Platformsh\Client\Model\Ref\UserRef; | ||
| use Symfony\Component\Console\Attribute\AsCommand; | ||
|
|
@@ -118,12 +119,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int | |
| $collection = UserExtendedAccess::getPagedCollection($url, $httpClient, $options); | ||
| $progress->done(); | ||
| $items = \array_merge($items, $collection['items']); | ||
| if (count($collection['items']) > 0 && isset($collection['next']) && $collection['next'] !== $url) { | ||
| $url = $collection['next']; | ||
| $pageNumber++; | ||
| continue; | ||
| $nextPage = PaginationUtil::nextPage($collection['next'], $url, $options['query']); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Warning — Same last-page warning regression on the user-projects listing. Same unguarded read as in the subscription list: |
||
| if ($nextPage === null) { | ||
| break; | ||
| } | ||
| break; | ||
| [$url, $options['query']] = $nextPage; | ||
| $pageNumber++; | ||
| } | ||
|
|
||
| if (empty($items)) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Warning — Emits a spurious PHP warning on the last page in verbose mode where the key was previously isset-guarded.
$collection['next']is now read unconditionally, whereas the previous code guarded every access withisset($collection['next'])(both in the loop and the display block). On the last pagegetPagedCollection()does not populatenext, so PHP raisesUndefined array key "next". Under-vthe application setserror_reporting(E_ALL & ~E_DEPRECATED)withdisplay_errors = stderr(Application.php), so this warning is printed to stderr on the final page of every subscription listing — the same verbose mode used to verify this PR.