Skip to content

refactor(jobmonitor)!: data table virtualization, search bar decomposition, context split - #498

Open
aldbr wants to merge 1 commit into
DIRACGrid:mainfrom
aldbr:split/4-jobmonitor-core
Open

refactor(jobmonitor)!: data table virtualization, search bar decomposition, context split#498
aldbr wants to merge 1 commit into
DIRACGrid:mainfrom
aldbr:split/4-jobmonitor-core

Conversation

@aldbr

@aldbr aldbr commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Part of #494 (stack 4/5). Stacked on #497 — until it merges, review the last commit only (refactor(jobmonitor)!). This is the core of the stack (~60 files); the three concerns are inseparable because JobMonitor must compile at every point, but each lives in its own directory:

Shared DataTable (shared/DataTable/)

  • monolithic DataTable.tsx split into DataTable / Header / Toolbar / SplitActionButton; virtualization migrated from react-virtuoso to @tanstack/react-virtual (react-virtuoso dropped)
  • memoized row component, overscan 8, pinned-column offsets precomputed; spacer rows only render when non-empty (keeps tbody tr:first/last-child a data row — the e2e suite relies on this)
  • stale rows + LinearProgress while revalidating instead of unmounting into a skeleton on every page/sort change

SearchBar (shared/SearchBar/)

  • decomposed into useSearchBarReducer / useFilterSync / useSearchSuggestions; equations get stable ids
  • token classification is now deterministic (static operator vocabulary) instead of racing the debounced suggestions state — fast typing (ID, =, 1) no longer silently drops tokens
  • suggestion group-by queries are cached and abortable; restoring saved filters no longer fires summary POSTs

Job Monitor (JobMonitor/)

  • state moves into a reducer + split State/Api contexts (a row-checkbox click no longer re-renders the search bar, pie chart, and every status cell); persistence extracted into useJobMonitorPersistence (500 ms debounce, rowSelection excluded)
  • jobDataService migrates to the abortable services/fetcher; jobs search sends a column projection (parameters); SWR tuned: keepPreviousData, revalidateIfStale: true, deduping 5 s (fixes stale rows after changing rows-per-page)
  • pie chart: summary rows travel with the grouping that produced them (fixes "undefined" legend entries + duplicate-key legend corruption after switching group-by)

Tests: suite grows 60 → 100 (reducer, filter sync, persistence, pie-chart labeling/interaction). E2E expectations updated for the new export format; adds mobile.cy.ts.

BREAKING CHANGE: the tuple-based fetcher is no longer exported from hooks (use services); Operators.EGUALS typo fixed to Operators.EQUALS.

🤖 Generated with Claude Code

@aldbr

aldbr commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Per review of #496 (force-pushed): the @tanstack/react-virtual dependency declaration moved from #496 into this PR — the same commit that removes react-virtuoso and adds the virtualized DataTable that imports it. Net dependencies at the stack tip are unchanged.

@aldbr
aldbr force-pushed the split/4-jobmonitor-core branch 11 times, most recently from 54a0376 to 9a340ef Compare July 16, 2026 07:26
…sition, context split, SWR tuning

Rework the Job Monitor stack end to end:

- split the monolithic shared/DataTable.tsx into a DataTable/ module
  (DataTable, DataTableHeader, DataTableToolbar, SplitActionButton)
  virtualized with @tanstack/react-virtual instead of react-virtuoso;
  react-virtuoso is dropped from dependencies
- extract a reusable shared/PieChart component (with stories and a11y
  legend tests) and a shared visuallyHidden helper
- decompose the SearchBar: state moves into a useSearchBarReducer,
  URL/filter synchronisation into useFilterSync, and suggestion
  fetching into useSearchSuggestions; equations gain stable ids and
  the Operators.EGUALS typo becomes Operators.EQUALS
- restructure the Job Monitor: column definitions move to
  jobColumns.tsx, per-application persistence to
  useJobMonitorPersistence, and shared state to a JobMonitorContext;
  jobDataService migrates to the services/fetcher client with SWR
  keys tuned to avoid refetch storms
- finish the fetcher migration: hooks/utils.tsx loses the legacy
  tuple-based fetcher (now services/client with named options and
  abort support), hooks/metadata.tsx and the gubbins OwnerMonitor
  consume the new client, and the package root exports the explicit
  final API surface
- jest config/setup updated for react-virtual (structured-clone
  ponyfill, layout mocks); e2e specs updated and a mobile viewport
  spec added; next.config gains a services alias for dev HMR and the
  app a test:headless script

BREAKING CHANGE: the tuple-based fetcher export is gone from
@dirac-grid/diracx-web-components/hooks; use the object-based fetcher
from @dirac-grid/diracx-web-components/services instead.
Operators.EGUALS is renamed Operators.EQUALS, and the DataTable API
changed with the module split.
@aldbr
aldbr force-pushed the split/4-jobmonitor-core branch from 9a340ef to 932cdf0 Compare July 16, 2026 13:49
@aldbr
aldbr requested a review from ryuwd July 17, 2026 07:52
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.

Quality pass: library packaging, Job Monitor performance, state correctness, test coverage

1 participant