@softwarity/livewire 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -23,7 +23,6 @@ readonly source = new LiveWindowDataSource<MessageRow>(
23
23
  (total) => this.total.set(total),
24
24
  () => this.messages.resync(),
25
25
  100,
26
- inject(ChangeDetectorRef), // what repaints a zoneless screen - see rule 1
27
26
  );
28
27
 
29
28
  constructor() {
@@ -50,19 +49,15 @@ constructor() {
50
49
 
51
50
  Each of these cost a debugging session in the application this came from.
52
51
 
53
- **1. Say that something arrived.** A row arriving from a socket callback
54
- schedules no change detection at all in a zoneless application: the field is
55
- right and the screen is wrong. Two ways to say it, and either is enough.
56
-
57
- - **Hand the data source a `ChangeDetectorRef`** (above). It calls
58
- `markForCheck()` on every publication, which marks the view dirty *and*
59
- notifies the zoneless scheduler. The template then says only what it shows.
60
- - **Or read `revision()` in the template** — `[attr.data-revision]="source.revision()"`
61
- on the viewport is enough. Use this when the source is built outside an
62
- injection context, where there is no `ChangeDetectorRef` to inject.
63
-
64
- `ApplicationRef.tick()` is the third way and the wrong one: it throws when it
65
- lands inside a cycle already in progress.
52
+ **1. Build the data source in the component that shows the list.** A row
53
+ arriving from a socket callback schedules no change detection at all in a
54
+ zoneless application: the field is right and the screen is wrong. Built in a
55
+ component field, the data source injects that view's `ChangeDetectorRef` and
56
+ calls `markForCheck()` on every publication — which marks the view dirty *and*
57
+ notifies the zoneless scheduler. Built outside an injection context it throws,
58
+ and that is the intended answer: a data source with no view to repaint has
59
+ nobody to answer. (`ApplicationRef.tick()` is the other way and the wrong one:
60
+ it throws when it lands inside a cycle already in progress.)
66
61
 
67
62
  **2. The window size is a constant per screen, never derived from the
68
63
  viewport.** Deriving it loops: publish → the viewport re-measures → a new window