Skip to content

refactor(datagrid): de-duplicate pagination helpers and guard All rows on unknown totals (#1364)#1411

Merged
datlechin merged 1 commit into
mainfrom
refactor/1364-pagination-cleanup
May 24, 2026
Merged

refactor(datagrid): de-duplicate pagination helpers and guard All rows on unknown totals (#1364)#1411
datlechin merged 1 commit into
mainfrom
refactor/1364-pagination-cleanup

Conversation

@datlechin

Copy link
Copy Markdown
Member

Follow-up cleanup to #1408 (the pagination bar, which is now merged). Internal refactors plus one small behavior guard, no change to the public surface.

Refactors (de-duplication)

  • PaginationState: extracted a private setPage(_:) that single-sources the currentOffset = (page - 1) * pageSize arithmetic previously repeated across six navigation methods.
  • PaginationCoordinator: extracted a private confirmLargeFetch(...) for the warning-alert + sheet/modal presentation that showAllRows and fetchAllRows both duplicated.
  • PaginationControlsView: collapsed the two near-identical popovers (jump-to-page, custom page size) into one submitPopover(...) helper.
  • MainStatusBarView: extracted isPagedWithUnknownTotal, shared by showsPaginationControls and rowInfoText.

Behavior

  • Guard: "All rows…" in the page-size menu is now disabled when the table's total row count is unknown (it previously appeared but silently did nothing there). Folded in here rather than as a separate Fixed entry since the feature is still unreleased.
  • Added accessibility labels to the jump and custom page-size text fields.

Everything else is unchanged: same UI, same navigation/disabled logic, same String(localized:) keys, and every navigation method keeps its exact guard and result (the PaginationState tests still assert the same currentPage/currentOffset). SwiftLint --strict is clean.

Not built locally; relying on CI / the Xcode build for the compile.

@datlechin datlechin merged commit 2f20aad into main May 24, 2026
2 checks passed
@datlechin datlechin deleted the refactor/1364-pagination-cleanup branch May 24, 2026 08:23
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.

1 participant