vorma 0.85.0-pre.12 → 0.85.0-pre.13
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/.dist/vorma/core/_index.d.ts +6 -4
- package/.dist/vorma/core/_index.d.ts.map +1 -1
- package/.dist/vorma/core/_index.js +29 -13
- package/.dist/vorma/core/_index.js.map +1 -1
- package/.dist/vorma/tsx/preact/preact.d.ts +1 -0
- package/.dist/vorma/tsx/preact/preact.d.ts.map +1 -1
- package/.dist/vorma/tsx/react/react.d.ts +1 -0
- package/.dist/vorma/tsx/react/react.d.ts.map +1 -1
- package/.dist/vorma/tsx/remix/remix.d.ts +1 -0
- package/.dist/vorma/tsx/remix/remix.d.ts.map +1 -1
- package/.dist/vorma/tsx/solid/solid.d.ts +1 -0
- package/.dist/vorma/tsx/solid/solid.d.ts.map +1 -1
- package/package.json +1 -1
- package/vorma/core/ccc_effect_experiment_notes.md +4 -0
- package/vorma/core/create_client_core.ts +49 -14
- package/vorma/core/create_client_core_effect.ts +16 -14
- package/vorma/core/effect_runtime/client_contract.ts +4 -4
- package/vorma/core/effect_runtime/client_kernel_assembly.ts +1 -0
- package/vorma/core/effect_runtime/client_navigation_services.ts +6 -2
- package/vorma/core/effect_runtime/client_session.ts +57 -0
- package/vorma/core/effect_runtime/index.ts +1 -0
- package/vorma/core/effect_runtime/revalidation_coordinator.ts +56 -24
- package/vorma/core/effect_runtime/route_revalidator.ts +6 -3
- package/vorma/core/effect_runtime/submit_manager.ts +35 -11
- package/vorma/core/effect_runtime/work_indicator.ts +13 -6
- package/vorma/core/effect_runtime/work_state_actor.ts +25 -5
- package/vorma/core/make_link_props.ts +16 -0
- package/vorma/core/types.ts +1 -0
- package/vorma/core/ui_adapter_core.ts +1 -0
- package/vorma/create/package.json +1 -1
|
@@ -17,14 +17,14 @@ import {
|
|
|
17
17
|
WORK_REVALIDATION_STATUS_DEBOUNCING,
|
|
18
18
|
WORK_REVALIDATION_STATUS_RETRYING,
|
|
19
19
|
WORK_REVALIDATION_STATUS_RUNNING,
|
|
20
|
-
type
|
|
20
|
+
type WorkRevalidationInput,
|
|
21
21
|
type WorkStateActor,
|
|
22
22
|
} from "./work_state_actor.ts";
|
|
23
23
|
|
|
24
24
|
export type RouteRevalidator = {
|
|
25
25
|
request: (
|
|
26
26
|
reason: Exclude<RevalidationReason, "retry">,
|
|
27
|
-
options?: { debounce?: boolean },
|
|
27
|
+
options?: { debounce?: boolean; skipWorkIndicator?: boolean },
|
|
28
28
|
) => Effect.Effect<RevalidationResult>;
|
|
29
29
|
cancel: Effect.Effect<void>;
|
|
30
30
|
snapshot: Effect.Effect<RevalidationCoordinatorSnapshot>;
|
|
@@ -139,7 +139,7 @@ function run_revalidation_attempt(
|
|
|
139
139
|
|
|
140
140
|
function work_revalidation_from_snapshot(
|
|
141
141
|
snapshot: RevalidationCoordinatorSnapshot,
|
|
142
|
-
):
|
|
142
|
+
): WorkRevalidationInput | null {
|
|
143
143
|
if (snapshot.phase === "idle") {
|
|
144
144
|
return null;
|
|
145
145
|
}
|
|
@@ -147,17 +147,20 @@ function work_revalidation_from_snapshot(
|
|
|
147
147
|
return {
|
|
148
148
|
status: WORK_REVALIDATION_STATUS_DEBOUNCING,
|
|
149
149
|
attempt: snapshot.attempt,
|
|
150
|
+
skipWorkIndicator: snapshot.skipWorkIndicator,
|
|
150
151
|
};
|
|
151
152
|
}
|
|
152
153
|
if (snapshot.phase === "retrying") {
|
|
153
154
|
return {
|
|
154
155
|
status: WORK_REVALIDATION_STATUS_RETRYING,
|
|
155
156
|
attempt: snapshot.attempt,
|
|
157
|
+
skipWorkIndicator: snapshot.skipWorkIndicator,
|
|
156
158
|
};
|
|
157
159
|
}
|
|
158
160
|
return {
|
|
159
161
|
status: WORK_REVALIDATION_STATUS_RUNNING,
|
|
160
162
|
attempt: snapshot.attempt,
|
|
163
|
+
skipWorkIndicator: snapshot.skipWorkIndicator,
|
|
161
164
|
};
|
|
162
165
|
}
|
|
163
166
|
|
|
@@ -73,7 +73,10 @@ export type SubmitManagerOptions = {
|
|
|
73
73
|
dispatch: (
|
|
74
74
|
request: SubmitDispatch,
|
|
75
75
|
) => Effect.Effect<Response, SubmitDispatchFailed | SubmitAborted>;
|
|
76
|
-
revalidate?: (
|
|
76
|
+
revalidate?: (
|
|
77
|
+
reason: "apiRequest",
|
|
78
|
+
options?: { skipWorkIndicator?: boolean },
|
|
79
|
+
) => Effect.Effect<RevalidationResult>;
|
|
77
80
|
redirect?: (href: string, kind: "client" | "hard") => Effect.Effect<void>;
|
|
78
81
|
report_build_skew?: (
|
|
79
82
|
dispatch: SubmitDispatch,
|
|
@@ -161,7 +164,12 @@ export function make_submit_manager(
|
|
|
161
164
|
});
|
|
162
165
|
const revalidate =
|
|
163
166
|
options.revalidate ??
|
|
164
|
-
((
|
|
167
|
+
((
|
|
168
|
+
_reason: "apiRequest",
|
|
169
|
+
_options?: {
|
|
170
|
+
skipWorkIndicator?: boolean;
|
|
171
|
+
},
|
|
172
|
+
) => {
|
|
165
173
|
return Effect.succeed(REVALIDATION_OK);
|
|
166
174
|
});
|
|
167
175
|
const report_build_skew =
|
|
@@ -204,6 +212,7 @@ export function make_submit_manager(
|
|
|
204
212
|
|
|
205
213
|
const revalidation_now = (
|
|
206
214
|
should_revalidate: boolean,
|
|
215
|
+
skip_work_indicator?: boolean,
|
|
207
216
|
): Effect.Effect<Effect.Effect<RevalidationResult>> => {
|
|
208
217
|
if (!should_revalidate) {
|
|
209
218
|
return Effect.succeed(Effect.succeed(REVALIDATION_OK));
|
|
@@ -212,7 +221,9 @@ export function make_submit_manager(
|
|
|
212
221
|
const deferred_result =
|
|
213
222
|
yield* Deferred.make<RevalidationResult>();
|
|
214
223
|
yield* Effect.forkDaemon(
|
|
215
|
-
revalidate("apiRequest"
|
|
224
|
+
revalidate("apiRequest", {
|
|
225
|
+
skipWorkIndicator: skip_work_indicator,
|
|
226
|
+
}).pipe(
|
|
216
227
|
Effect.flatMap((result) => {
|
|
217
228
|
return Deferred.succeed(deferred_result, result);
|
|
218
229
|
}),
|
|
@@ -242,6 +253,7 @@ export function make_submit_manager(
|
|
|
242
253
|
yield* Fiber.interruptFork(submission.fiber);
|
|
243
254
|
const revalidation_effect = yield* revalidation_now(
|
|
244
255
|
submission.shouldRevalidate,
|
|
256
|
+
submission.skipWorkIndicator,
|
|
245
257
|
);
|
|
246
258
|
yield* resolve_waiter(submission.waiter, {
|
|
247
259
|
success: false,
|
|
@@ -398,6 +410,7 @@ export function make_submit_manager(
|
|
|
398
410
|
dispatch: SubmitDispatch,
|
|
399
411
|
response: Response,
|
|
400
412
|
should_revalidate: boolean,
|
|
413
|
+
skip_work_indicator: boolean,
|
|
401
414
|
): Effect.Effect<SubmitResult, never> => {
|
|
402
415
|
return Effect.catchAll(
|
|
403
416
|
Effect.gen(function* () {
|
|
@@ -439,8 +452,10 @@ export function make_submit_manager(
|
|
|
439
452
|
};
|
|
440
453
|
}
|
|
441
454
|
if (!response.ok) {
|
|
442
|
-
const revalidation_effect =
|
|
443
|
-
|
|
455
|
+
const revalidation_effect = yield* revalidation_now(
|
|
456
|
+
should_revalidate,
|
|
457
|
+
skip_work_indicator,
|
|
458
|
+
);
|
|
444
459
|
return {
|
|
445
460
|
success: false as const,
|
|
446
461
|
error: response.statusText,
|
|
@@ -449,8 +464,10 @@ export function make_submit_manager(
|
|
|
449
464
|
};
|
|
450
465
|
}
|
|
451
466
|
const data = yield* response_data(response);
|
|
452
|
-
const revalidation_effect =
|
|
453
|
-
|
|
467
|
+
const revalidation_effect = yield* revalidation_now(
|
|
468
|
+
should_revalidate,
|
|
469
|
+
skip_work_indicator,
|
|
470
|
+
);
|
|
454
471
|
return {
|
|
455
472
|
success: true as const,
|
|
456
473
|
data,
|
|
@@ -472,6 +489,7 @@ export function make_submit_manager(
|
|
|
472
489
|
const run_submission = (
|
|
473
490
|
dispatch: SubmitDispatch,
|
|
474
491
|
should_revalidate: boolean,
|
|
492
|
+
skip_work_indicator: boolean,
|
|
475
493
|
): Effect.Effect<void, never> => {
|
|
476
494
|
const normalize_defect = (error: unknown): Effect.Effect<void> => {
|
|
477
495
|
return Queue.offer(queue, {
|
|
@@ -491,6 +509,7 @@ export function make_submit_manager(
|
|
|
491
509
|
dispatch,
|
|
492
510
|
response,
|
|
493
511
|
should_revalidate,
|
|
512
|
+
skip_work_indicator,
|
|
494
513
|
);
|
|
495
514
|
}),
|
|
496
515
|
Effect.flatMap((result) => {
|
|
@@ -504,8 +523,10 @@ export function make_submit_manager(
|
|
|
504
523
|
Effect.catchAll((error) => {
|
|
505
524
|
if (error instanceof SubmitAborted) {
|
|
506
525
|
return Effect.gen(function* () {
|
|
507
|
-
const revalidation_effect =
|
|
508
|
-
|
|
526
|
+
const revalidation_effect = yield* revalidation_now(
|
|
527
|
+
should_revalidate,
|
|
528
|
+
skip_work_indicator,
|
|
529
|
+
);
|
|
509
530
|
yield* Queue.offer(queue, {
|
|
510
531
|
_tag: "Completed",
|
|
511
532
|
id: dispatch.id,
|
|
@@ -519,8 +540,10 @@ export function make_submit_manager(
|
|
|
519
540
|
});
|
|
520
541
|
}
|
|
521
542
|
return Effect.gen(function* () {
|
|
522
|
-
const revalidation_effect =
|
|
523
|
-
|
|
543
|
+
const revalidation_effect = yield* revalidation_now(
|
|
544
|
+
should_revalidate,
|
|
545
|
+
skip_work_indicator,
|
|
546
|
+
);
|
|
524
547
|
yield* Queue.offer(queue, {
|
|
525
548
|
_tag: "Completed",
|
|
526
549
|
id: dispatch.id,
|
|
@@ -566,6 +589,7 @@ export function make_submit_manager(
|
|
|
566
589
|
run_submission(
|
|
567
590
|
prepared.dispatch,
|
|
568
591
|
prepared.shouldRevalidate,
|
|
592
|
+
command.request.options?.skipWorkIndicator === true,
|
|
569
593
|
),
|
|
570
594
|
);
|
|
571
595
|
next_active.set(key, {
|
|
@@ -93,7 +93,7 @@ export function make_work_indicator(): Effect.Effect<
|
|
|
93
93
|
previous.options &&
|
|
94
94
|
previous.options !== options
|
|
95
95
|
) {
|
|
96
|
-
previous.options.
|
|
96
|
+
previous.options.stop();
|
|
97
97
|
}
|
|
98
98
|
yield* Ref.set(state_ref, {
|
|
99
99
|
...previous,
|
|
@@ -111,7 +111,7 @@ export function make_work_indicator(): Effect.Effect<
|
|
|
111
111
|
yield* cancel_timer(state.show_timer);
|
|
112
112
|
yield* cancel_timer(state.hide_timer);
|
|
113
113
|
if (state.visible && state.options) {
|
|
114
|
-
state.options.
|
|
114
|
+
state.options.stop();
|
|
115
115
|
}
|
|
116
116
|
release_vorma_work = null;
|
|
117
117
|
yield* Ref.set(state_ref, {
|
|
@@ -180,7 +180,7 @@ function sync_indicator(
|
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
182
|
const show_timer = yield* start_timer(
|
|
183
|
-
options.
|
|
183
|
+
options.startDelayMS ?? WORK_INDICATOR_DEFAULT_SHOW_DELAY_MS,
|
|
184
184
|
show_indicator(state_ref),
|
|
185
185
|
);
|
|
186
186
|
yield* Ref.set(state_ref, {
|
|
@@ -191,6 +191,13 @@ function sync_indicator(
|
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
193
|
yield* cancel_timer(state.show_timer);
|
|
194
|
+
if (!state.visible) {
|
|
195
|
+
yield* Ref.set(state_ref, {
|
|
196
|
+
...state,
|
|
197
|
+
show_timer: null,
|
|
198
|
+
});
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
194
201
|
if (state.hide_timer) {
|
|
195
202
|
yield* Ref.set(state_ref, {
|
|
196
203
|
...state,
|
|
@@ -199,7 +206,7 @@ function sync_indicator(
|
|
|
199
206
|
return;
|
|
200
207
|
}
|
|
201
208
|
const hide_timer = yield* start_timer(
|
|
202
|
-
options.
|
|
209
|
+
options.stopDelayMS ?? WORK_INDICATOR_DEFAULT_HIDE_DELAY_MS,
|
|
203
210
|
hide_indicator(state_ref),
|
|
204
211
|
);
|
|
205
212
|
yield* Ref.set(state_ref, {
|
|
@@ -222,7 +229,7 @@ function show_indicator(
|
|
|
222
229
|
});
|
|
223
230
|
return;
|
|
224
231
|
}
|
|
225
|
-
state.options.
|
|
232
|
+
state.options.start();
|
|
226
233
|
yield* Ref.set(state_ref, {
|
|
227
234
|
...state,
|
|
228
235
|
visible: true,
|
|
@@ -243,7 +250,7 @@ function hide_indicator(
|
|
|
243
250
|
});
|
|
244
251
|
return;
|
|
245
252
|
}
|
|
246
|
-
state.options.
|
|
253
|
+
state.options.stop();
|
|
247
254
|
yield* Ref.set(state_ref, {
|
|
248
255
|
...state,
|
|
249
256
|
hide_timer: null,
|
|
@@ -30,6 +30,9 @@ export type WorkIndicatorActivity = {
|
|
|
30
30
|
export type WorkNavigationInput = WorkNavigation & {
|
|
31
31
|
skipWorkIndicator?: boolean;
|
|
32
32
|
};
|
|
33
|
+
export type WorkRevalidationInput = WorkRevalidation & {
|
|
34
|
+
skipWorkIndicator?: boolean;
|
|
35
|
+
};
|
|
33
36
|
export type WorkAPIRequestInput = WorkAPIRequest & {
|
|
34
37
|
skipWorkIndicator?: boolean;
|
|
35
38
|
};
|
|
@@ -39,7 +42,7 @@ export type WorkStateActor = {
|
|
|
39
42
|
navigation: WorkNavigationInput | null,
|
|
40
43
|
) => Effect.Effect<void>;
|
|
41
44
|
set_revalidation: (
|
|
42
|
-
revalidation:
|
|
45
|
+
revalidation: WorkRevalidationInput | null,
|
|
43
46
|
) => Effect.Effect<void>;
|
|
44
47
|
set_prefetch: (prefetch: WorkPrefetch | null) => Effect.Effect<void>;
|
|
45
48
|
set_api_requests: (
|
|
@@ -65,6 +68,7 @@ type Model = {
|
|
|
65
68
|
readonly state: WorkState;
|
|
66
69
|
readonly last_emitted: WorkState;
|
|
67
70
|
readonly navigation_skip_work_indicator: boolean;
|
|
71
|
+
readonly revalidation_skip_work_indicator: boolean;
|
|
68
72
|
readonly api_request_skip_work_indicators: ReadonlyMap<string, boolean>;
|
|
69
73
|
readonly last_indicator_activity: WorkIndicatorActivity;
|
|
70
74
|
};
|
|
@@ -77,7 +81,7 @@ type Command =
|
|
|
77
81
|
}
|
|
78
82
|
| {
|
|
79
83
|
readonly _tag: typeof COMMAND_SET_REVALIDATION;
|
|
80
|
-
readonly revalidation:
|
|
84
|
+
readonly revalidation: WorkRevalidationInput | null;
|
|
81
85
|
readonly ack: Deferred.Deferred<void>;
|
|
82
86
|
}
|
|
83
87
|
| {
|
|
@@ -130,6 +134,7 @@ export function make_work_state_actor(
|
|
|
130
134
|
state: EMPTY_WORK_STATE,
|
|
131
135
|
last_emitted: EMPTY_WORK_STATE,
|
|
132
136
|
navigation_skip_work_indicator: false,
|
|
137
|
+
revalidation_skip_work_indicator: false,
|
|
133
138
|
api_request_skip_work_indicators: new Map(),
|
|
134
139
|
last_indicator_activity: EMPTY_WORK_INDICATOR_ACTIVITY,
|
|
135
140
|
});
|
|
@@ -283,16 +288,29 @@ export function make_work_state_actor(
|
|
|
283
288
|
});
|
|
284
289
|
};
|
|
285
290
|
|
|
291
|
+
const public_revalidation = (
|
|
292
|
+
revalidation: WorkRevalidationInput,
|
|
293
|
+
): WorkRevalidation => {
|
|
294
|
+
return {
|
|
295
|
+
status: revalidation.status,
|
|
296
|
+
attempt: revalidation.attempt,
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
|
|
286
300
|
const set_revalidation_now = (
|
|
287
|
-
revalidation:
|
|
301
|
+
revalidation: WorkRevalidationInput | null,
|
|
288
302
|
): Effect.Effect<void> => {
|
|
289
303
|
return update_model((current) => {
|
|
290
304
|
return {
|
|
291
305
|
...current,
|
|
292
306
|
state: {
|
|
293
307
|
...current.state,
|
|
294
|
-
revalidation
|
|
308
|
+
revalidation: revalidation
|
|
309
|
+
? public_revalidation(revalidation)
|
|
310
|
+
: null,
|
|
295
311
|
},
|
|
312
|
+
revalidation_skip_work_indicator:
|
|
313
|
+
revalidation?.skipWorkIndicator === true,
|
|
296
314
|
};
|
|
297
315
|
});
|
|
298
316
|
};
|
|
@@ -455,7 +473,9 @@ function indicator_activity_from_model(current: Model): WorkIndicatorActivity {
|
|
|
455
473
|
navigation:
|
|
456
474
|
current.state.navigation !== null &&
|
|
457
475
|
!current.navigation_skip_work_indicator,
|
|
458
|
-
revalidation:
|
|
476
|
+
revalidation:
|
|
477
|
+
current.state.revalidation !== null &&
|
|
478
|
+
!current.revalidation_skip_work_indicator,
|
|
459
479
|
apiRequests: current.state.apiRequests.some((request) => {
|
|
460
480
|
return (
|
|
461
481
|
current.api_request_skip_work_indicators.get(request.key) !==
|
|
@@ -38,6 +38,7 @@ export type LinkNavFns = {
|
|
|
38
38
|
href: string;
|
|
39
39
|
replace?: boolean;
|
|
40
40
|
scrollToTop?: boolean;
|
|
41
|
+
skipWorkIndicator?: boolean;
|
|
41
42
|
state?: unknown;
|
|
42
43
|
}) => Promise<{ didNavigate: boolean }>;
|
|
43
44
|
start_prefetch: (href: string) => void;
|
|
@@ -57,6 +58,8 @@ export type LinkNavFns = {
|
|
|
57
58
|
};
|
|
58
59
|
};
|
|
59
60
|
|
|
61
|
+
export const skip_work_indicator_link_prop = "skipWorkIndicator";
|
|
62
|
+
|
|
60
63
|
const VORMA_KEYS = new Set([
|
|
61
64
|
"attributeMatchRules",
|
|
62
65
|
"pattern",
|
|
@@ -64,6 +67,7 @@ const VORMA_KEYS = new Set([
|
|
|
64
67
|
"prefetchDelayMs",
|
|
65
68
|
"replace",
|
|
66
69
|
"scrollToTop",
|
|
70
|
+
skip_work_indicator_link_prop,
|
|
67
71
|
"state",
|
|
68
72
|
"visitOnPointerDown",
|
|
69
73
|
]);
|
|
@@ -196,6 +200,9 @@ export function make_link_props(
|
|
|
196
200
|
const prefetch_delay = (props.prefetchDelayMs as number | undefined) ?? 100;
|
|
197
201
|
const replace = props.replace as boolean | undefined;
|
|
198
202
|
const scroll_to_top = props.scrollToTop as boolean | undefined;
|
|
203
|
+
const skip_work_indicator = props[skip_work_indicator_link_prop] as
|
|
204
|
+
| boolean
|
|
205
|
+
| undefined;
|
|
199
206
|
const state = props.state as unknown;
|
|
200
207
|
const target_attr = props.target as string | undefined;
|
|
201
208
|
const visit_on_pointer_down = props.visitOnPointerDown as
|
|
@@ -265,6 +272,9 @@ export function make_link_props(
|
|
|
265
272
|
href,
|
|
266
273
|
replace,
|
|
267
274
|
scrollToTop: scroll_to_top,
|
|
275
|
+
...(skip_work_indicator === undefined
|
|
276
|
+
? {}
|
|
277
|
+
: { skipWorkIndicator: skip_work_indicator }),
|
|
268
278
|
state,
|
|
269
279
|
});
|
|
270
280
|
} catch (err) {
|
|
@@ -317,6 +327,12 @@ export function make_link_props(
|
|
|
317
327
|
href,
|
|
318
328
|
replace,
|
|
319
329
|
scrollToTop: scroll_to_top,
|
|
330
|
+
...(skip_work_indicator === undefined
|
|
331
|
+
? {}
|
|
332
|
+
: {
|
|
333
|
+
skipWorkIndicator:
|
|
334
|
+
skip_work_indicator,
|
|
335
|
+
}),
|
|
320
336
|
});
|
|
321
337
|
} catch (err) {
|
|
322
338
|
console.error(
|
package/vorma/core/types.ts
CHANGED