Commit bffc528
fix: bind controllers before custom connectedCallback behavior
If a controller synchronously dispatches events in its
connectedCallback, `data-action` handlers register the event too late,
because connectedCallback itself is a synchronous callback, while
`MutationObserver` is tasked.
This changes `bind` to be called _before_ custom `connectedCallback`
behavior so that any events dispatched in a `connectedCallback` are
captured by the `data-action` handler, making for a simpler
understanding of `data-action` handlers.
By making this change we allow developers to not have to internalise the
idea of dispatching events during Synchronous or Asynchronous
tasks/microtasks. Developers can simply dispatch an event without
worrying if it was synchronous or not.
Co-authored-by: Kristján Oddsson <koddsson@gmail.com>1 parent 550468c commit bffc528
2 files changed
Lines changed: 22 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
19 | 40 | | |
0 commit comments