Drain queued propchange events on reconnect#120
Conversation
5c64952 to
7907d85
Compare
70c36ac to
c4e3cf8
Compare
7907d85 to
13367a4
Compare
c4e3cf8 to
05ccdb9
Compare
13367a4 to
98d136f
Compare
05ccdb9 to
d1d74a5
Compare
98d136f to
e76d161
Compare
LeaVerou
left a comment
There was a problem hiding this comment.
"drain" reads more like an implementation detail than a user-facing concept. Plus, drain what? It's missing context.
I think it would be useful to make these first-class concepts, with a method to stop dispatching events and another one to resume and drain, and frame around that. I suspect this could also be more efficient, though I haven't seen the code that adds to queue to verify. And I can certainly see that being useful in other situations as well.
b8022d0 to
520b067
Compare
Per review feedback on #120: 'drain' reads as an implementation detail and lacks context. The new name says what the method dispatches and that they were queued, matching the existing eventDispatchQueue field.
da9a76c to
25112e1
Compare
d1d74a5 to
08e199b
Compare
Per review feedback on #120: 'drain' reads as an implementation detail and lacks context. The new name says what the method dispatches and that they were queued, matching the existing eventDispatchQueue field.
08e199b to
d1d74a5
Compare
25112e1 to
da9a76c
Compare
Per review feedback on #120: 'drain' reads as an implementation detail and lacks context. The new name says what the method dispatches and that they were queued, matching the existing eventDispatchQueue field.
da9a76c to
fd394ef
Compare
d1d74a5 to
e163920
Compare
Per review feedback on #120: 'drain' reads as an implementation detail and lacks context. The new name says what the method dispatches and that they were queued, matching the existing eventDispatchQueue field.
fd394ef to
f8bedf0
Compare
Per review feedback on #120: 'drain' reads as an implementation detail and lacks context. The new name says what the method dispatches and that they were queued, matching the existing eventDispatchQueue field.
3625381 to
f7356e7
Compare
f8bedf0 to
afd9438
Compare
Per review feedback on #120: 'drain' reads as an implementation detail and lacks context. The new name says what the method dispatches and that they were queued, matching the existing eventDispatchQueue field.
afd9438 to
d2d4b7a
Compare
f7356e7 to
5d2dac7
Compare
Per review feedback on #120: 'drain' reads as an implementation detail and lacks context. The new name says what the method dispatches and that they were queued, matching the existing eventDispatchQueue field.
6b12c36 to
9dd342c
Compare
d2d4b7a to
589ad50
Compare
|
Done — reframed as |
Events fired while the element is disconnected are queued in firePropChangeEvent. Previously, the queue only drained in Props.initializeFor, which runs from the once-per-element `constructed` hook — so events queued during a disconnect→reconnect cycle were lost. Extract the inline drain into Props.drainFor and call it from a new `connected` hook in props/index.js. The hook fires on every connect; on first connect the queue is already empty after initializeFor's drain, so no double-dispatch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Per review feedback on #120: 'drain' reads as an implementation detail and lacks context. The new name says what the method dispatches and that they were queued, matching the existing eventDispatchQueue field.
1b7c407 to
d3109eb
Compare
Replaces the implicit isConnected check with an explicit #paused WeakSet, exposed via pauseEvents/resumeEvents on Props. Lifecycle hooks wire disconnected → pauseEvents, connected → resumeEvents. Foundation for manual batching (#51).
d3109eb to
c1a7bff
Compare
LeaVerou
left a comment
There was a problem hiding this comment.
We should coalesce, but this can be done in a separate PR
Summary
Replaces the implicit
isConnectedqueue check with an explicitpauseEvents/resumeEventsprimitive onProps, gated by a#pausedWeakSet. Lifecycle hooks wiredisconnected → pauseEventsandconnected → resumeEvents— same fix, first-class primitive for #51 batching to build on.Addresses Lea's review.
Tests
96/102 PASS locally (4 pre-existing skipped). The original reconnect regression test is unchanged. One new test covers the primitive directly: pause → writes → resume, asserting no dispatch during pause and ordered drain on resume.
The 2 reds (
Post-mount setAttribute…,removeAttribute collapses…) are owned by #117 and will go green once it merges — this PR deliberately doesn't carry that commit.