-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlimitations.html
More file actions
1041 lines (901 loc) · 32.4 KB
/
limitations.html
File metadata and controls
1041 lines (901 loc) · 32.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Limitations — Flow-Arch</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=Syne:wght@600;700;800&family=Newsreader:ital,wght@0,300;0,400;1,300&display=swap" rel="stylesheet">
<style>
:root {
--bg: #0a0a0a;
--surface: #111;
--border: #1e1e1e;
--accent: #c8f542;
--dim: #8faa2a;
--text: #e2e2dc;
--muted: #5a5a54;
--code-bg: #141414;
--warn: #e0a86c;
--fn-mono: 'DM Mono', monospace;
--fn-disp: 'Syne', sans-serif;
--fn-body: 'Newsreader', serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
background: var(--bg);
color: var(--text);
font-family: var(--fn-body);
font-size: 17px;
line-height: 1.75;
}
::selection { background: var(--accent); color: #000; }
.wrap {
display: grid;
grid-template-columns: 220px 1fr;
min-height: 100vh;
}
/* ── SIDEBAR ── */
aside {
position: sticky;
top: 0;
height: 100vh;
overflow-y: auto;
border-right: 1px solid var(--border);
padding: 40px 24px;
background: var(--bg);
}
.sidebar-logo {
font-family: var(--fn-mono);
font-size: 11px;
color: var(--accent);
letter-spacing: 0.15em;
text-transform: uppercase;
margin-bottom: 8px;
display: block;
text-decoration: none;
}
.sidebar-back {
font-family: var(--fn-mono);
font-size: 11px;
color: var(--muted);
text-decoration: none;
display: block;
margin-bottom: 32px;
transition: color 0.15s;
}
.sidebar-back:hover { color: var(--accent); }
.sidebar-label {
font-family: var(--fn-mono);
font-size: 9px;
letter-spacing: 0.2em;
color: var(--muted);
text-transform: uppercase;
margin-bottom: 10px;
margin-top: 28px;
}
.sidebar-nav {
list-style: none;
display: flex;
flex-direction: column;
gap: 2px;
}
.sidebar-nav a {
font-family: var(--fn-mono);
font-size: 12px;
color: var(--muted);
text-decoration: none;
padding: 5px 10px;
border-radius: 4px;
display: block;
transition: all 0.15s;
line-height: 1.4;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
color: var(--accent);
background: rgba(200,245,66,0.06);
}
/* ── MAIN ── */
main {
padding: 60px 64px 120px;
max-width: 780px;
}
.breadcrumb {
font-family: var(--fn-mono);
font-size: 11px;
color: var(--muted);
margin-bottom: 40px;
display: flex;
align-items: center;
gap: 8px;
}
.breadcrumb a {
color: var(--accent);
text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--muted); }
/* ── HERO ── */
.page-hero {
margin-bottom: 64px;
}
.page-eyebrow {
font-family: var(--fn-mono);
font-size: 10px;
letter-spacing: 0.2em;
color: var(--warn);
text-transform: uppercase;
margin-bottom: 16px;
}
h1 {
font-family: var(--fn-disp);
font-size: clamp(36px, 5vw, 56px);
font-weight: 800;
letter-spacing: -0.03em;
line-height: 1.05;
margin-bottom: 20px;
}
h1 em {
font-style: italic;
font-family: var(--fn-body);
font-weight: 300;
color: var(--warn);
}
.lead {
font-size: 18px;
color: #c0c0ba;
font-style: italic;
line-height: 1.6;
margin-bottom: 28px;
}
/* ── SUMMARY TABLE ── */
.summary-table {
border: 1px solid var(--border);
border-radius: 8px;
overflow: hidden;
margin: 32px 0 64px;
}
.summary-table table {
width: 100%;
border-collapse: collapse;
}
.summary-table th {
font-family: var(--fn-mono);
font-size: 10px;
letter-spacing: 0.12em;
text-transform: uppercase;
color: var(--muted);
padding: 12px 16px;
text-align: left;
border-bottom: 1px solid var(--border);
background: var(--surface);
}
.summary-table td {
font-family: var(--fn-mono);
font-size: 12px;
padding: 12px 16px;
border-bottom: 1px solid var(--border);
color: var(--muted);
vertical-align: middle;
}
.summary-table tr:last-child td { border-bottom: none; }
.summary-table tr:hover td { background: rgba(255,255,255,0.02); }
.summary-table td:first-child {
color: var(--warn);
font-weight: 500;
white-space: nowrap;
}
.summary-table td:nth-child(2) {
color: var(--text);
}
.summary-table td a {
color: var(--accent);
text-decoration: none;
}
.summary-table td a:hover { text-decoration: underline; }
/* ── STATUS BADGE ── */
.badge {
font-family: var(--fn-mono);
font-size: 10px;
letter-spacing: 0.08em;
padding: 3px 8px;
border-radius: 100px;
white-space: nowrap;
}
.badge.known { background: rgba(224,168,108,0.1); color: var(--warn); border: 1px solid rgba(224,168,108,0.3); }
.badge.exploring { background: rgba(200,245,66,0.1); color: var(--accent); border: 1px solid rgba(200,245,66,0.3); }
.badge.partial { background: rgba(126,207,207,0.1); color: #7ecfcf; border: 1px solid rgba(126,207,207,0.3); }
.badge.resolved { background: rgba(100,180,100,0.1); color: #80c880; border: 1px solid rgba(100,180,100,0.3); }
.priority { color: var(--muted); font-size: 11px; }
.priority.high { color: #cc6666; }
.priority.medium { color: var(--warn); }
.priority.low { color: var(--muted); }
/* ── LIMITATION SECTIONS ── */
.limitation {
padding-top: 64px;
border-top: 1px solid var(--border);
margin-bottom: 0;
}
.limitation:first-of-type { border-top: none; padding-top: 0; }
.lim-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
margin-bottom: 20px;
flex-wrap: wrap;
}
.lim-id {
font-family: var(--fn-mono);
font-size: 11px;
color: var(--warn);
letter-spacing: 0.1em;
margin-bottom: 8px;
}
h2 {
font-family: var(--fn-disp);
font-size: 22px;
font-weight: 700;
letter-spacing: -0.02em;
line-height: 1.2;
}
h3 {
font-family: var(--fn-mono);
font-size: 11px;
letter-spacing: 0.12em;
text-transform: uppercase;
color: var(--muted);
margin: 24px 0 10px;
}
p { color: #a8a8a2; margin-bottom: 12px; }
p strong { color: var(--text); font-weight: 400; }
p:last-child { margin-bottom: 0; }
/* ── CODE BLOCK ── */
.code-block {
background: var(--code-bg);
border: 1px solid var(--border);
border-radius: 8px;
overflow: hidden;
margin: 16px 0;
}
.code-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 9px 16px;
border-bottom: 1px solid var(--border);
}
.code-title {
font-family: var(--fn-mono);
font-size: 10px;
color: var(--muted);
letter-spacing: 0.08em;
}
.code-lang {
font-family: var(--fn-mono);
font-size: 10px;
color: var(--dim);
}
pre {
padding: 20px;
overflow-x: auto;
font-family: var(--fn-mono);
font-size: 13px;
line-height: 1.85;
color: #c0c0b8;
}
.k { color: var(--accent); }
.s { color: #9aba3a; }
.c { color: #383830; }
.f { color: #7ecfcf; }
.n { color: #e0a86c; }
.bad { color: #cc6666; }
.ok { color: #80c880; }
/* ── CALLOUT ── */
.callout {
border-left: 2px solid var(--accent);
background: rgba(200,245,66,0.04);
border-radius: 0 6px 6px 0;
padding: 14px 18px;
margin: 16px 0;
}
.callout.warn {
border-left-color: var(--warn);
background: rgba(224,168,108,0.04);
}
.callout-label {
font-family: var(--fn-mono);
font-size: 10px;
color: var(--accent);
letter-spacing: 0.15em;
text-transform: uppercase;
margin-bottom: 6px;
}
.callout.warn .callout-label { color: var(--warn); }
.callout p { font-size: 14px; color: #a0a09a; margin: 0; }
/* ── OPEN QUESTION ── */
.open-question {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 8px;
padding: 18px 22px;
margin: 16px 0;
}
.oq-label {
font-family: var(--fn-mono);
font-size: 10px;
color: var(--accent);
letter-spacing: 0.15em;
text-transform: uppercase;
margin-bottom: 8px;
}
.oq-text {
font-size: 15px;
color: #b0b0aa;
font-style: italic;
line-height: 1.6;
}
/* ── EXPERIMENT LINK ── */
.experiment-link {
display: inline-flex;
align-items: center;
gap: 8px;
font-family: var(--fn-mono);
font-size: 11px;
color: var(--muted);
border: 1px solid var(--border);
padding: 7px 14px;
border-radius: 6px;
text-decoration: none;
margin-top: 8px;
transition: all 0.15s;
}
.experiment-link:hover {
color: var(--accent);
border-color: var(--dim);
}
.experiment-link::before { content: '⌗'; margin-right: 2px; }
/* ── CONTRIBUTE BANNER ── */
.contribute {
border: 1px solid var(--border);
border-radius: 8px;
padding: 28px;
margin-top: 72px;
background: var(--surface);
}
.contribute-label {
font-family: var(--fn-mono);
font-size: 10px;
color: var(--accent);
letter-spacing: 0.15em;
text-transform: uppercase;
margin-bottom: 12px;
}
.contribute h2 {
font-size: 20px;
margin-bottom: 12px;
}
.contribute p {
font-size: 15px;
margin-bottom: 16px;
}
.btn {
font-family: var(--fn-mono);
font-size: 12px;
letter-spacing: 0.08em;
padding: 10px 20px;
border-radius: 4px;
text-decoration: none;
display: inline-block;
transition: all 0.2s;
border: 1px solid var(--border);
color: var(--muted);
}
.btn:hover { color: var(--accent); border-color: var(--dim); }
code {
font-family: var(--fn-mono);
font-size: 12px;
background: #1a1a1a;
border: 1px solid var(--border);
padding: 1px 6px;
border-radius: 3px;
color: var(--accent);
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.4; }
}
@media (max-width: 768px) {
.wrap { grid-template-columns: 1fr; }
aside { display: none; }
main { padding: 32px 24px 80px; }
}
</style>
</head>
<body>
<div class="wrap">
<!-- ═══ SIDEBAR ═══ -->
<aside>
<a href="index.html" class="sidebar-logo">flow-arch/</a>
<a href="index.html" class="sidebar-back">← back to home</a>
<p class="sidebar-label">Overview</p>
<ul class="sidebar-nav">
<li><a href="#intro">Introduction</a></li>
<li><a href="#summary">Summary Table</a></li>
</ul>
<p class="sidebar-label">Limitations</p>
<ul class="sidebar-nav">
<li><a href="#l01">L-01 innerHTML Replacement</a></li>
<li><a href="#l02">L-02 No Shared State</a></li>
<li><a href="#l03">L-03 No Async Actions</a></li>
<li><a href="#l04">L-04 No Enforced Purity</a></li>
<li><a href="#l05">L-05 No Type Safety</a></li>
<li><a href="#l06">L-06 No SSR</a></li>
<li><a href="#l07">L-07 Boilerplate</a></li>
</ul>
<p class="sidebar-label">Contribute</p>
<ul class="sidebar-nav">
<li><a href="#contribute">Report a limitation</a></li>
</ul>
</aside>
<!-- ═══ MAIN ═══ -->
<main>
<!-- BREADCRUMB -->
<div class="breadcrumb">
<a href="index.html">flow-arch</a>
<span>/</span>
<span>limitations</span>
</div>
<!-- HERO -->
<div id="intro" class="page-hero">
<p class="page-eyebrow">Honest Documentation</p>
<h1>Known<br><em>Limitations.</em></h1>
<p class="lead">
This is a living record of what Flow-Arch cannot do well — yet.
Every limitation is an open research question.
Honesty about constraints is part of the methodology.
</p>
<p>
Each entry describes the problem, explains when it matters,
shows any current workaround, and frames the open question
it leaves behind. Limitations resolved through experiments
will be updated here.
</p>
<div class="callout" style="margin-top:24px">
<div class="callout-label">Philosophy</div>
<p>
A limitation honestly documented is more valuable than a feature
dishonestly promoted. If you find something missing from this list,
<strong style="color:var(--text)">that is a contribution</strong>.
</p>
</div>
</div>
<!-- SUMMARY TABLE -->
<div id="summary">
<div class="summary-table">
<table>
<thead>
<tr>
<th>ID</th>
<th>Limitation</th>
<th>Status</th>
<th>Priority</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="#l01">L-01</a></td>
<td>Full innerHTML replacement on every render</td>
<td><span class="badge known">KNOWN</span></td>
<td><span class="priority high">High</span></td>
</tr>
<tr>
<td><a href="#l02">L-02</a></td>
<td>No inter-component state management</td>
<td><span class="badge known">KNOWN</span></td>
<td><span class="priority high">High</span></td>
</tr>
<tr>
<td><a href="#l03">L-03</a></td>
<td>No async action handling</td>
<td><span class="badge known">KNOWN</span></td>
<td><span class="priority medium">Medium</span></td>
</tr>
<tr>
<td><a href="#l04">L-04</a></td>
<td>No enforced purity (inherent to JS)</td>
<td><span class="badge known">KNOWN</span></td>
<td><span class="priority low">Low</span></td>
</tr>
<tr>
<td><a href="#l05">L-05</a></td>
<td>String-based view has no type safety</td>
<td><span class="badge known">KNOWN</span></td>
<td><span class="priority medium">Medium</span></td>
</tr>
<tr>
<td><a href="#l06">L-06</a></td>
<td>No SSR implementation yet</td>
<td><span class="badge known">KNOWN</span></td>
<td><span class="priority medium">Medium</span></td>
</tr>
<tr>
<td><a href="#l07">L-07</a></td>
<td>Component boilerplate repetition</td>
<td><span class="badge known">KNOWN</span></td>
<td><span class="priority low">Low</span></td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- ── L-01 ── -->
<div id="l01" class="limitation">
<div class="lim-header">
<div>
<div class="lim-id">L-01</div>
<h2>Full innerHTML Replacement<br>on Every Render</h2>
</div>
<span class="badge known">KNOWN</span>
</div>
<h3>What happens</h3>
<p>
Every time state changes, the entire Shadow DOM is destroyed and rebuilt from scratch.
</p>
<div class="code-block">
<div class="code-header">
<span class="code-title">the current pattern</span>
<span class="code-lang">JS</span>
</div>
<pre><span class="f">render</span>() {
<span class="c">// Every render — full replacement</span>
<span class="c">// Old nodes destroyed. New nodes created.</span>
<span class="k">this</span>.shadowRoot.innerHTML = <span class="f">view</span>(<span class="k">this</span>.state)
}</pre>
</div>
<h3>Why it is a problem</h3>
<p>The browser must destroy all existing nodes, parse the new HTML string, create all new nodes, recalculate styles, re-layout, and repaint — even when only one value changed.</p>
<div class="code-block">
<div class="code-header">
<span class="code-title">concrete consequences</span>
<span class="code-lang">JS</span>
</div>
<pre><span class="c">// 1. Input loses focus on every render</span>
<span class="bad">// <input> is destroyed and recreated — cursor position lost</span>
<span class="c">// 2. CSS transitions reset</span>
<span class="bad">// transition: opacity 0.3s — resets every render because
// the element is a brand new node each time</span>
<span class="c">// 3. Expensive for large lists</span>
<span class="bad">// 100 todo items = 100 nodes destroyed + 100 recreated
// on every single keystroke or tick</span></pre>
</div>
<h3>When it does not matter</h3>
<p>Simple components updated on user click (counter, toggle, timer). DOM trees with fewer than ~20 nodes. No <code><input></code> elements inside the component.</p>
<div class="open-question">
<div class="oq-label">Open Question</div>
<p class="oq-text">
Can we build a minimal DOM diff algorithm in pure vanilla JS,
without dependencies, that still fits the Flow-Arch pure function philosophy?
What is the minimum viable diffing strategy?
</p>
</div>
<a class="experiment-link" href="#">experiments/dom-diff/ — not started yet</a>
</div>
<!-- ── L-02 ── -->
<div id="l02" class="limitation">
<div class="lim-header">
<div>
<div class="lim-id">L-02</div>
<h2>No Inter-Component<br>State Management</h2>
</div>
<span class="badge known">KNOWN</span>
</div>
<h3>What happens</h3>
<p>
Each Web Component manages its own private state.
There is no shared store or global state layer.
Two sibling components cannot share data directly.
</p>
<h3>Current workaround</h3>
<p>Use <code>CustomEvent</code> to bubble data up, and attributes to pass data down. It works but becomes verbose for complex trees.</p>
<div class="code-block">
<div class="code-header">
<span class="code-title">manual event bus pattern</span>
<span class="code-lang">JS</span>
</div>
<pre><span class="c">// Child → Parent: dispatch a custom event</span>
<span class="k">this</span>.<span class="f">dispatchEvent</span>(<span class="k">new</span> CustomEvent(<span class="s">"state-changed"</span>, {
bubbles: <span class="k">true</span>,
detail: { count: <span class="k">this</span>.state.count }
}))
<span class="c">// Parent → Child: set attribute</span>
childEl.<span class="f">setAttribute</span>(<span class="s">"count"</span>, newCount)
<span class="c">// This works. But with 5+ components it becomes
// very hard to trace where data comes from.</span></pre>
</div>
<div class="open-question">
<div class="oq-label">Open Question</div>
<p class="oq-text">
Can a global store be designed as a pure function system,
consistent with Flow-Arch's philosophy, without introducing
a framework or complex observer pattern?
</p>
</div>
<a class="experiment-link" href="#">experiments/global-store/ — not started yet</a>
</div>
<!-- ── L-03 ── -->
<div id="l03" class="limitation">
<div class="lim-header">
<div>
<div class="lim-id">L-03</div>
<h2>No Async Action Handling</h2>
</div>
<span class="badge known">KNOWN</span>
</div>
<h3>What happens</h3>
<p>
Reducers are synchronous pure functions.
There is no built-in mechanism for async operations like <code>fetch</code>.
</p>
<div class="code-block">
<div class="code-header">
<span class="code-title">async is not allowed in reducers</span>
<span class="code-lang">JS</span>
</div>
<pre><span class="c">// ✗ This breaks the pure function contract</span>
<span class="k">const</span> <span class="f">reducer</span> = <span class="k">async</span> (state, action) => {
<span class="k">const</span> data = <span class="k">await</span> <span class="f">fetch</span>(<span class="s">"/api/data"</span>) <span class="bad">// ✗ side effect</span>
<span class="k">return</span> { ...state, data }
}
<span class="c">// ✓ Current workaround: async in the component shell</span>
<span class="k">async</span> <span class="f">connectedCallback</span>() {
<span class="k">this</span>.<span class="f">dispatch</span>({ type: <span class="s">"LOADING"</span> })
<span class="k">const</span> res = <span class="k">await</span> <span class="f">fetch</span>(<span class="s">"/api/data"</span>)
<span class="k">const</span> data = <span class="k">await</span> res.<span class="f">json</span>()
<span class="c">// Then dispatch synchronously with the result</span>
<span class="k">this</span>.<span class="f">dispatch</span>({ type: <span class="s">"DATA_LOADED"</span>, payload: data })
}</pre>
</div>
<div class="callout warn">
<div class="callout-label">Trade-off</div>
<p>
Keeping reducers synchronous is not a bug — it is a deliberate choice.
Async reducers make testing harder and blur the boundary between
pure logic and side effects. The workaround above keeps the
separation intact, but has no standard pattern yet.
</p>
</div>
<div class="open-question">
<div class="oq-label">Open Question</div>
<p class="oq-text">
What is the Flow-Arch equivalent of Redux-Thunk?
Can a lightweight effect system be designed without middleware complexity,
keeping reducers pure and async logic explicit?
</p>
</div>
<a class="experiment-link" href="#">experiments/async-actions/ — not started yet</a>
</div>
<!-- ── L-04 ── -->
<div id="l04" class="limitation">
<div class="lim-header">
<div>
<div class="lim-id">L-04</div>
<h2>No Enforced Purity</h2>
</div>
<span class="badge known">KNOWN</span>
</div>
<h3>What happens</h3>
<p>
Unlike Haskell or Elm, JavaScript cannot enforce that reducers
and view functions are truly pure. Side effects can be written
inside them with no warning from the language.
</p>
<div class="code-block">
<div class="code-header">
<span class="code-title">JS cannot stop this</span>
<span class="code-lang">JS</span>
</div>
<pre><span class="c">// This compiles and runs fine — JS does not care</span>
<span class="k">const</span> <span class="f">reducer</span> = (state, action) => {
console.<span class="f">log</span>(<span class="s">"side effect"</span>) <span class="bad">// ✗ impure</span>
localStorage.<span class="f">setItem</span>(<span class="s">"x"</span>, <span class="s">"y"</span>) <span class="bad">// ✗ impure</span>
<span class="k">return</span> { ...state } <span class="ok">// ✓ pure return</span>
}
<span class="c">// Compare: Haskell makes this impossible at compile time</span>
<span class="c">// IO actions must be declared in the type signature</span>
<span class="c">// pure :: Int -> Int ← enforced pure</span>
<span class="c">// impure :: Int -> IO Int ← enforced impure</span></pre>
</div>
<h3>Honest assessment</h3>
<p>
This limitation is <strong>inherent to JavaScript</strong>.
It cannot be fully solved without a type system or compiler.
Flow-Arch accepts this and relies on discipline, documentation, and code review.
</p>
<div class="callout">
<div class="callout-label">What helps</div>
<p>
ESLint rule <code>no-param-reassign</code> catches mutation.
TypeScript <code>readonly</code> reduces mutation risk.
Neither fully solves the problem — they reduce it.
</p>
</div>
</div>
<!-- ── L-05 ── -->
<div id="l05" class="limitation">
<div class="lim-header">
<div>
<div class="lim-id">L-05</div>
<h2>String-Based View Has<br>No Type Safety</h2>
</div>
<span class="badge known">KNOWN</span>
</div>
<h3>What happens</h3>
<p>
The <code>view</code> function returns an HTML string via a template literal.
Typos in HTML structure fail silently. Typos in state properties
cause runtime errors. There is no autocomplete, no validation.
</p>
<div class="code-block">
<div class="code-header">
<span class="code-title">silent failure modes</span>
<span class="code-lang">JS</span>
</div>
<pre><span class="k">const</span> <span class="f">view</span> = (state) => <span class="s">`
<div class="contaner"> </span><span class="bad">← typo: silent failure</span><span class="s">
<p>${state.usr.name}</p> </span><span class="bad">← typo: runtime TypeError</span><span class="s">
<p>${state.userInput}</p> </span><span class="bad">← XSS if not sanitized</span><span class="s">
</div>
`</span>
<span class="c">// Minimum protection: sanitize user input</span>
<span class="k">const</span> <span class="f">escape</span> = (str) =>
String(str)
.<span class="f">replace</span>(/&/g, <span class="s">"&amp;"</span>)
.<span class="f">replace</span>(/</g, <span class="s">"&lt;"</span>)
.<span class="f">replace</span>(/>/g, <span class="s">"&gt;"</span>)
<span class="c">// Always escape before interpolating user data</span>
<span class="k">const</span> <span class="f">view</span> = (state) => <span class="s">`
<p>${<span class="f">escape</span>(state.userInput)}</p>
`</span></pre>
</div>
<div class="open-question">
<div class="oq-label">Open Question</div>
<p class="oq-text">
Could a lightweight tagged template literal function provide
automatic sanitization and basic validation,
without abandoning the pure function view pattern?
This could become part of <code>flow-core.js</code>.
</p>
</div>
</div>
<!-- ── L-06 ── -->
<div id="l06" class="limitation">
<div class="lim-header">
<div>
<div class="lim-id">L-06</div>
<h2>No SSR Implementation Yet</h2>
</div>
<span class="badge known">KNOWN</span>
</div>
<h3>What happens</h3>
<p>
Flow-Arch components are defined and rendered entirely in the browser.
The page is blank until JavaScript runs. Search engines may not
see component content.
</p>
<h3>The platform solution already exists</h3>
<p>
Declarative Shadow DOM allows Shadow DOM to be rendered as plain HTML
by the server — no JavaScript required. Flow-Arch does not use this yet.
</p>
<div class="code-block">
<div class="code-header">
<span class="code-title">declarative shadow dom — server renders this</span>
<span class="code-lang">HTML</span>
</div>
<pre><span class="c"><!-- Rendered by server. Works without any JavaScript. --></span>
<<span class="f">flow-counter</span>>
<template shadowrootmode=<span class="s">"open"</span>>
<style>.count { color: #c8f542; }</style>
<div class=<span class="s">"count"</span>>0</div>
<button>+</button>
</template>
</<span class="f">flow-counter</span>>
<span class="c"><!-- When JS loads, the component hydrates in place --></span>
<span class="c"><!-- No flash of unstyled content --></span></pre>
</div>
<div class="open-question">
<div class="oq-label">Open Question</div>
<p class="oq-text">
How does Flow-Arch's State → View → Reducer loop integrate
with server-side rendering and hydration?
Can the pure <code>view()</code> function generate both
the server HTML and the client render from the same code?
</p>
</div>
<a class="experiment-link" href="#">experiments/ssr/ — not started yet</a>
</div>
<!-- ── L-07 ── -->
<div id="l07" class="limitation">
<div class="lim-header">
<div>
<div class="lim-id">L-07</div>
<h2>Component Boilerplate Repetition</h2>
</div>
<span class="badge known">KNOWN</span>
</div>
<h3>What happens</h3>
<p>
Every Flow-Arch component repeats the same structural boilerplate.
The unique logic of each component is buried inside identical scaffolding.
</p>
<div class="code-block">
<div class="code-header">
<span class="code-title">repeated in every component</span>
<span class="code-lang">JS</span>
</div>
<pre><span class="c">// This exact structure appears in every component</span>
<span class="k">class</span> <span class="f">AnyComponent</span> <span class="k">extends</span> HTMLElement {
<span class="f">constructor</span>() {
<span class="k">super</span>()
<span class="k">this</span>.<span class="f">attachShadow</span>({ mode: <span class="s">"open"</span> })
<span class="k">this</span>.state = <span class="f">createInitialState</span>()
<span class="k">this</span>.dispatch = (action) => {
<span class="k">this</span>.state = <span class="f">reducer</span>(<span class="k">this</span>.state, action)
<span class="k">this</span>.<span class="f">render</span>()
}
}
<span class="f">connectedCallback</span>() { <span class="k">this</span>.<span class="f">render</span>() }
<span class="f">render</span>() { <span class="k">this</span>.shadowRoot.innerHTML = <span class="f">view</span>(<span class="k">this</span>.state) }
}
<span class="c">// Proposed: a factory that removes the boilerplate</span>
<span class="k">const</span> FlowCounter = <span class="f">createFlowComponent</span>(reducer, view)
customElements.<span class="f">define</span>(<span class="s">"flow-counter"</span>, FlowCounter)
<span class="c">// This is one of the most promising paths to flow-core.js</span></pre>
</div>
<div class="open-question">
<div class="oq-label">Open Question</div>
<p class="oq-text">
A <code>createFlowComponent(reducer, view)</code> factory function
could eliminate the boilerplate entirely.
This would be the first step toward a real <code>flow-core.js</code>.
What should its API look like?
</p>
</div>
</div>