question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Component *change events consistency

See original GitHub issue

Bug, feature request, or proposal:

Proposal.

What is the expected behavior?

I’d expect all components to have the same behavior. Or all return a plain object, or all return an instance of a class.

What is the current behavior?

Some components return a plain object, others return an instance of a class.

What components have a different behavior?

Topic 1 (About emit a plain object):

Chip: https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/chips/chip.ts#L183

Paginator: https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/paginator/paginator.ts#L189

Sort: https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/sort/sort.ts#L131


Topic 2 (Some “change” events are named ...Event, some others are ...Change and others are ...ChangeEvent): https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/autocomplete/autocomplete.ts#L35 Suffixed by ‘Event’.

https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/tabs/tab-group.ts#L43 This is the only event that is suffixed by ‘Change’ and ‘Event’.

https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/chips/chip.ts#L25 Besides being an interface (not a class), it isn’t suffixed by ‘Change’.

https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/chips/chip-input.ts#L16 Not sure about this. I think this can’t be considered inconsistency, but I’ll left it here anyway.

https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/paginator/paginator.ts#L30 Suffixed by ‘Event’.

https://github.com/angular/material2/blob/5210b3e197647381611ec48ddcd99333ec5356e9/src/lib/sort/sort.ts#L41 Besides being an interface (not a class), it isn’t suffixed by ‘Change’.

Is there anything else we should know?

Maybe it’s a complement of #6677.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jelbourncommented, Aug 4, 2020

Vivian had been the one owning this project, but she left the team a long while ago, and it basically fell to the wayside when that happened. With everything else we’ve got going on now, I don’t think this will be on our radar in 2020.

1reaction
rafaelss95commented, Jan 18, 2018

Hey @amcdnl, as I said it’s a complement of #6677.

There are inconsistencies here that aren’t pointed out in that issue.

And, according to your last comment there you’ve already done all the work for that issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

(Number) Ensure type consistency in change event #742
(Number) Ensure type consistency in change event When a value is typed in the component, the event returns a string value (NumberChange.value).
Read more >
A Gentle Introduction to Event-driven Change Data Capture
1. Change event generation. The transaction log mining component captures the changes from the source database. It converts them into events and publishes...
Read more >
Why Strong Consistency Matters with Event-driven Architectures
Different consumers of events can be used to create read models, syndicate data, and prepare batch jobs that are eventually consistent.
Read more >
Event Sourcing: Eventual Consistency and Responding to ...
A read model that is eventually consistent will regularly 'fall out of sync' with the underlying data, as changes are being processed in...
Read more >
Handy Naming Conventions for Event Handler Functions ...
However, in order to maintain consistency between your React components and keep your code clean, it helps to have some sort of naming...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found