fix(material/table): return undefined sort and paginator#31593
fix(material/table): return undefined sort and paginator#31593andrewseguin merged 1 commit intoangular:mainfrom
Conversation
The initial value for `sort` and `paginator` is `undefined` and since angular#31269 the setter accepts `undefined` too (typically from a signal child query). This change aligns the getter type with the real type and makes it symmetric with the setter.
| * emitted by the MatSort will trigger an update to the table's rendered data. | ||
| */ | ||
| get sort(): MatSort | null { | ||
| get sort(): MatSort | null | undefined { |
There was a problem hiding this comment.
This is technically a public API change. It might be better to change the setter to || null so the runtime matches the type.
There was a problem hiding this comment.
I got LGTM from @andrewseguin to proceed in this direction. I already prepared google3 for that. It was easy - 3 places where the type was explicitly copied.
Given that it always could have returned undefined, there may be code handling that. A breaking compile time check is safer than changing runtime behavior. Coalescing to null caught tests in google3 that expected that what they put in is what they get back.
There was a problem hiding this comment.
I think this change aligns closer to what is actually happening, since sort actually can return undefined when its unset. Since this expands the set rather than constricting, I don't know if this counts as a major "breaking" change.
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The initial value for
sortandpaginatorisundefinedand since #31269 the setter acceptsundefinedtoo (typically from a signal child query). This change aligns the getter type with the real type and makes it symmetric with the setter.