ballerina-core 1.0.216 → 1.0.217

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "ballerina-core",
3
3
  "author": "Dr. Giuseppe Maggiore",
4
4
  "private": false,
5
- "version": "1.0.216",
5
+ "version": "1.0.217",
6
6
  "main": "main.ts",
7
7
  "scripts": {
8
8
  "prettier": "prettier --write ."
@@ -15,7 +15,7 @@ export const debouncer = <
15
15
  DebouncerCo<CustomPresentationContext, ExtraContext>().Repeat(
16
16
  DebouncerCo<CustomPresentationContext, ExtraContext>().Seq([
17
17
  Debounce<
18
- Value<Map<string, string>>,
18
+ Value<[Map<string, string>, boolean]>,
19
19
  { onDebounce: SimpleCallback<void> }
20
20
  >(
21
21
  DebouncedCo.GetState()
@@ -32,7 +32,7 @@ export const initializeStream = <
32
32
  100,
33
33
  // safe because we check for undefined in the runFilter
34
34
  current.customFormState.getChunkWithParams!(maybeId.value)(
35
- current.customFormState.streamParams.value,
35
+ current.customFormState.streamParams.value[0],
36
36
  ),
37
37
  ),
38
38
  ),
@@ -49,5 +49,5 @@ export const DebouncerCo = <
49
49
 
50
50
  export const DebouncedCo = CoTypedFactory<
51
51
  { onDebounce: SimpleCallback<void> },
52
- Value<Map<string, string>>
52
+ Value<[Map<string, string>, boolean]>
53
53
  >();
@@ -20,7 +20,6 @@ import {
20
20
  RecordAbstractRendererState,
21
21
  ValueUnit,
22
22
  MapRepo,
23
- BasicFun2,
24
23
  Value,
25
24
  ValueCallbackWithOptionalFlags,
26
25
  VoidCallbackWithOptionalFlags,
@@ -31,6 +30,7 @@ import {
31
30
  BaseFlags,
32
31
  Sum,
33
32
  PredicateValue,
33
+ replaceWith,
34
34
  } from "../../../../../../../../main";
35
35
  import { Debounced } from "../../../../../../../debounced/state";
36
36
 
@@ -52,7 +52,7 @@ export type OneAbstractRendererState = CommonAbstractRendererState & {
52
52
  customFormState: {
53
53
  detailsState: RecordAbstractRendererState;
54
54
  previewStates: Map<string, RecordAbstractRendererState>;
55
- streamParams: Debounced<Value<Map<string, string>>>;
55
+ streamParams: Debounced<Value<[Map<string, string>, boolean]>>;
56
56
  status: "open" | "closed";
57
57
  stream: Sum<ValueInfiniteStreamState, "not initialized">;
58
58
  getChunkWithParams:
@@ -77,7 +77,7 @@ export const OneAbstractRendererState = {
77
77
  customFormState: {
78
78
  detailsState: RecordAbstractRendererState.Default.zero(),
79
79
  previewStates: Map(),
80
- streamParams: Debounced.Default(Value.Default(Map())),
80
+ streamParams: Debounced.Default(Value.Default([Map(), false])),
81
81
  status: "closed",
82
82
  getChunkWithParams: getChunk,
83
83
  stream: Sum.Default.right("not initialized"),
@@ -112,10 +112,14 @@ export const OneAbstractRendererState = {
112
112
  streamParam: (
113
113
  key: string,
114
114
  _: BasicUpdater<string>,
115
+ shouldReload: boolean,
115
116
  ): Updater<OneAbstractRendererState> =>
116
117
  OneAbstractRendererState.Updaters.Core.customFormState.children.streamParams(
117
118
  Debounced.Updaters.Template.value(
118
- Value.Updaters.value(MapRepo.Updaters.upsert(key, () => "", _)),
119
+ Value.Updaters.value((__) => [
120
+ MapRepo.Updaters.upsert(key, () => "", _)(__[0]),
121
+ shouldReload,
122
+ ]),
119
123
  ),
120
124
  ),
121
125
  },
@@ -182,7 +186,7 @@ export type OneAbstractRendererViewForeignMutationsExpected<Flags = BaseFlags> =
182
186
  {
183
187
  onChange: DispatchOnChange<ValueOption | ValueUnit, Flags>;
184
188
  toggleOpen: SimpleCallback<void>;
185
- setStreamParam: BasicFun2<string, string, void>;
189
+ setStreamParam: (key: string, value: string, shouldReload: boolean) => void;
186
190
  select: ValueCallbackWithOptionalFlags<ValueRecord, Flags>;
187
191
  create: ValueCallbackWithOptionalFlags<ValueRecord, Flags>;
188
192
  delete?: VoidCallbackWithOptionalFlags<Flags>;
@@ -338,11 +338,16 @@ export const OneAbstractRenderer = <
338
338
  : id,
339
339
  ),
340
340
  ),
341
- setStreamParam: (key: string, _) =>
341
+ setStreamParam: (
342
+ key: string,
343
+ value: string,
344
+ shouldReload: boolean,
345
+ ) =>
342
346
  props.setState(
343
347
  OneAbstractRendererState.Updaters.Template.streamParam(
344
348
  key,
345
- replaceWith(_),
349
+ replaceWith(value),
350
+ shouldReload,
346
351
  ).then(
347
352
  OneAbstractRendererState.Updaters.Core.customFormState.children.stream(
348
353
  Sum.Updaters.left(
@@ -457,18 +462,20 @@ export const OneAbstractRenderer = <
457
462
  return {
458
463
  ...props.context,
459
464
  onDebounce: () => {
460
- props.setState(
461
- OneAbstractRendererState.Updaters.Core.customFormState.children.stream(
462
- Sum.Updaters.left(
463
- ValueInfiniteStreamState.Updaters.Template.reload(
464
- // safe because we check for undefined in the runFilter
465
- props.context.customFormState.getChunkWithParams!(
466
- maybeId.value,
467
- )(props.context.customFormState.streamParams.value),
465
+ if (props.context.customFormState.streamParams.value[1]) {
466
+ props.setState(
467
+ OneAbstractRendererState.Updaters.Core.customFormState.children.stream(
468
+ Sum.Updaters.left(
469
+ ValueInfiniteStreamState.Updaters.Template.reload(
470
+ // safe because we check for undefined in the runFilter
471
+ props.context.customFormState.getChunkWithParams!(
472
+ maybeId.value,
473
+ )(props.context.customFormState.streamParams.value[0]),
474
+ ),
468
475
  ),
469
476
  ),
470
- ),
471
- );
477
+ );
478
+ }
472
479
  },
473
480
  };
474
481
  }),