Commit 243253a
committed
perf(frontend): preview only when the selected rule actually changed
Raised in review of #61, and my comment was the weaker claim: it said the
trigger fires on each keystroke, when it fires on ANY document mutation.
`rules` is rebuilt whenever `script` is reassigned, so adding, deleting or
reordering some OTHER rule rescheduled a preview of the selected one and
spent a request to be told the same bytes it was already showing.
Comparing the wire payload rather than the array reference makes those
free, and covers the keystroke that leaves wire content unchanged too. The
payload compared is the one that gets posted, so the two cannot drift.
An error clears the remembered payload, so the next mutation retries
rather than matching it and leaving the message up for good.
The comment now says what actually happens.
Not unit-tested: the logic is inside a .svelte file and this repo has no
component test harness. svelte-check, vitest and the build are clean.
Refs areyousievious-8fg.171 parent 623fcc8 commit 243253a
1 file changed
Lines changed: 24 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
42 | 49 | | |
43 | 50 | | |
44 | | - | |
45 | | - | |
46 | 51 | | |
| 52 | + | |
| 53 | + | |
47 | 54 | | |
48 | 55 | | |
| 56 | + | |
49 | 57 | | |
50 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
51 | 66 | | |
52 | 67 | | |
53 | | - | |
| 68 | + | |
54 | 69 | | |
55 | 70 | | |
56 | 71 | | |
| |||
61 | 76 | | |
62 | 77 | | |
63 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
64 | 82 | | |
65 | 83 | | |
66 | 84 | | |
| |||
92 | 110 | | |
93 | 111 | | |
94 | 112 | | |
95 | | - | |
96 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
97 | 116 | | |
98 | 117 | | |
99 | 118 | | |
| |||
0 commit comments