Skip to content

feat(material/table): accept undefined sort and paginator #31269

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rslawik
Copy link
Contributor

@rslawik rslawik commented May 31, 2025

Extend types of the sort and paginator setter to include undefined to avoid ?? null when using singals (e.g. viewChild).

@rslawik rslawik requested a review from a team as a code owner May 31, 2025 16:41
@rslawik rslawik requested review from andrewseguin and ok7sai and removed request for a team May 31, 2025 16:41
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: material/table labels May 31, 2025
@rslawik
Copy link
Contributor Author

rslawik commented Jul 10, 2025

Based on internal testing: I reduced the scope of this change to only accept undefined in the setter without coercing it to null because the initial values of this._paginator and this._sort are undefined exposed as null. This avoids build and test breakages.

We can accept the casts or consider making a breaking change as a follow up to either:

  1. Initialize this._sort: MatSort | null = null and coerce undefined to null in the setter. There are a handful targets to fix for that.
  2. Expose undefined in get sort(): MatSort | null | undefined and in this._sort. There are a few generic components wrapping the data source to fix.
  3. Replace null with undefined. This should be equivalent to 2 in effort.

Same for the paginator. These are fairly tractable to migrate incrementally, so I can help. But the decision which one should be made by the owner.

Extend types of the sort and paginator setter to include undefined to avoid `?? null` when using
singals (e.g. `viewChild`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material/table detected: feature PR contains a feature commit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant