Skip to content

refactor(tables): migrate four list tables to useDataTableParams#1269

Open
Dexterity104 wants to merge 1 commit into
entrius:testfrom
Dexterity104:refactor/migrate-tables-to-useDataTableParams
Open

refactor(tables): migrate four list tables to useDataTableParams#1269
Dexterity104 wants to merge 1 commit into
entrius:testfrom
Dexterity104:refactor/migrate-tables-to-useDataTableParams

Conversation

@Dexterity104
Copy link
Copy Markdown
Contributor

Summary

Migrate four list tables onto the existing useDataTableParams hook so URL backed sort, page, and filter state share a single helper. The hook already powers TopMinersTable and TopRepositoriesTable, and these four tables were duplicating the same inline boilerplate (manual useSearchParams reads plus useState for sortField/sortDir/page plus hand rolled setPage(0) resets on filter change).

Tables migrated:

  • MinerPRsTable: prPage and prStatus now flow through the hook. Sort state (previously local) is URL backed via sort and dir.
  • MinerOpenDiscoveryIssuesByRepo: same pattern for issuePage and issueStatus.
  • RepositoryPRsTable: prAuthor moved into the hook filters config. Sort and page state move to URL under prSort, prDir, and prPage. The session stored status filter remains a local concern.
  • RepositoryIssuesTable: sort and page state move to URL under issueSort, issueDir, and issuePage. The session stored status filter is unchanged.

All preexisting URL parameter names (prPage, prStatus, issuePage, issueStatus, prAuthor) stay byte identical so shareable links keep working. The DEFAULT_SORT_DIR per field overrides are preserved via the hook's defaultOrderOverrides, and the "reset page on filter change" semantics are preserved via the hook native page reset on setFilter and setSort.

For the two repository tables, the new sort and page params are prefixed (prSort/prDir/prPage and issueSort/issueDir/issuePage) so the Issues and PRs tabs on the repository details page do not stomp on each other when a user switches tabs.

For the miner tables, the existing useEffect keyed on [githubId] still clears local UI state when navigating between miners, and now also clears the URL sort and dir params so each miner opens with the default sort, matching prior behavior.

No new dependencies. No changes to useDataTableParams.

Related Issues

N/A

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other (describe below)

Screenshots

No UI or visual changes in this PR, so before/after media is not applicable.

Checklist

  • New components are modularized/separated where sensible
  • Uses predefined theme (e.g. no hardcoded colors)
  • Responsive/mobile checked
  • Tested against the test API
  • npm run format and npm run lint:fix have been run
  • npm run build passes
  • Screenshots included for any UI/visual changes

@xiao-xiao-mao xiao-xiao-mao Bot added the refactor Code restructuring without behavior change label May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code restructuring without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant