fix: add loading spinner for dynamic table paginator#2399
Open
Junjiequan wants to merge 8 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In DatasetTableComponent,
getTablePaginationConfignow requires anisLoadingargument whereas the proposals version makes it optional with a default; consider aligning the signatures (e.g.,isLoading = false) to avoid forcing all call sites to pass a value and keep the API consistent. - The new combined stream in DatasetTableComponent (
this.datasets$.pipe(combineLatestWith(..., this.selectColumnsWithFetchedSettings$.pipe(filter(...))))) will now re-runinitTableevery time datasets, user, counts, or facet loading state change, whereas previously the column settings were taken once; if repeated reinitialization is unnecessary or expensive, consider limiting the settings stream withtake(1)ordistinctUntilChangedand separating it from frequently changing data. - The
.paginator-container/.paginator-container.is-loadingstyles use a generic class name and::ng-deepon the paginator range label, which can bleed into other paginators using the same class; consider scoping the selector more tightly to the dynamic table component (e.g., via:hostor a more specific class) to avoid unintended global styling.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In DatasetTableComponent, `getTablePaginationConfig` now requires an `isLoading` argument whereas the proposals version makes it optional with a default; consider aligning the signatures (e.g., `isLoading = false`) to avoid forcing all call sites to pass a value and keep the API consistent.
- The new combined stream in DatasetTableComponent (`this.datasets$.pipe(combineLatestWith(..., this.selectColumnsWithFetchedSettings$.pipe(filter(...))))`) will now re-run `initTable` every time datasets, user, counts, or facet loading state change, whereas previously the column settings were taken once; if repeated reinitialization is unnecessary or expensive, consider limiting the settings stream with `take(1)` or `distinctUntilChanged` and separating it from frequently changing data.
- The `.paginator-container`/`.paginator-container.is-loading` styles use a generic class name and `::ng-deep` on the paginator range label, which can bleed into other paginators using the same class; consider scoping the selector more tightly to the dynamic table component (e.g., via `:host` or a more specific class) to avoid unintended global styling.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Pull request overview
Adds a loading state for facet count fetches and surfaces it as a spinner in the dynamic table paginator's range label for datasets and proposals.
Changes:
- Track
facetCountsIsLoadingin datasets and proposals state (set on fetch start, cleared on complete/failed) with corresponding selectors. - Add
isLoadingtoTablePaginationand render a CSS spinner on the paginator range label in the dynamic table when loading. - Refactor
DatasetTableComponentandProposalTableComponentsubscriptions to combine the new loading stream and pass it into pagination config.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/app/state-management/state/{datasets,proposals}.store.ts | Add facetCountsIsLoading field and initial value. |
| src/app/state-management/reducers/{datasets,proposals}.reducer.ts | Handle fetchFacetCounts start/complete/failed to toggle loading flag. |
| src/app/state-management/selectors/{datasets,proposals}.selectors.ts | New selectXFacetCountsIsLoading selector; rename selectProposalsfacetCounts → selectProposalsFacetCounts. |
| src/app/state-management/selectors/{datasets,proposals}.selectors.spec.ts | Add facetCountsIsLoading: false to mock initial states. |
| src/app/shared/modules/dynamic-material-table/models/table-pagination.model.ts | Add optional isLoading field. |
| src/app/shared/modules/dynamic-material-table/table/dynamic-mat-table.component.{html,scss} | Wrap paginators in container with .is-loading class and add CSS spinner. |
| src/app/datasets/dataset-table/dataset-table.component.ts | Refactor combined subscription; pass isLoading to pagination; spec updated. |
| src/app/datasets/dataset-table/dataset-table.component.spec.ts | Update getTablePaginationConfig call to include isLoading argument. |
| src/app/proposals/proposal-table/proposal-table.component.ts | Combine isFacetCountsLoading$ into subscription; pass to pagination config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| getTablePaginationConfig(dataCount = 0): TablePagination { | ||
| getTablePaginationConfig(dataCount = 0, isLoading: boolean): TablePagination { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Added a loading spinner to the dynamic paginator that appears when the facet request is in a pending state.
Currently, this feature is applied only to the datasets and proposals components, as they are the only two components that require facets at the moment.
The example clip uses a 2-second delay on the facets response to mimic a real-world scenario where the facets response is slow.
Screenshare.-.2026-06-02.10_26_06.AM.mov
Motivation
Background on use case, changes needed
Fixes:
Please provide a list of the fixes implemented in this PR
Changes:
Please provide a list of the changes implemented by this PR
Tests included
Documentation
official documentation info
If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included
Backend version
Summary by Sourcery
Add loading-state support to dynamic tables and facet-count fetches so paginators show a spinner while counts are being loaded.
New Features:
Bug Fixes:
Enhancements: