Skip to content

Commit cc678b2

Browse files
Update porting notes about all InconsistentChildrenStateError cases
1 parent 231e2ae commit cc678b2

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

packages/scenario/test/repeat.test.ts

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -401,16 +401,20 @@ describe('Tests ported from JavaRosa - repeats', () => {
401401
*
402402
* - It seems like the comment from JavaRosa on the above test may have
403403
* been intended for this test? It seems to _almost describe_ this
404-
* fixture. (Although to actually produce a consistent `count()` of 1, I
405-
* think the `calculate` would need to be `count(..)`.)
406-
*
407-
* - Failure is an `InconsistentChildrenStateError`. Without diving into
408-
* the cause, I've only ever seen this when experimenting with UI to
409-
* exercise the engine API capability to add repeat instances at any
410-
* index. It seemed pretty likely at the time that this was a Solid
411-
* compilation bug, as it appeared that Solid's JSX transform triggered
412-
* it. But this suggests that some (as yet undetermined) reactive
413-
* property access may be implicated.
404+
* fixture. (Although to actually produce a consistent `count()` of 1,
405+
* I think the `calculate` would need to be `count(..)`.)
406+
*
407+
* - Failure is an `InconsistentChildrenStateError`. ~~Without diving
408+
* into the cause, I've only ever seen this when experimenting with UI
409+
* to exercise the engine API capability to add repeat instances at
410+
* any index. It seemed pretty likely at the time that this was a
411+
* Solid compilation bug, as it appeared that Solid's JSX transform
412+
* triggered it. But this suggests that some (as yet undetermined)
413+
* reactive property access may be implicated.~~ This error goes away
414+
* if we unwrap the
415+
* {@link https://github.com/getodk/web-forms/blob/d40bd88ed8959bbe7fae5d28efc840c16ca50a72/packages/scenario/src/jr/Scenario.ts#L163-L173 | `createMemo` call}
416+
* in Scenario.ts. That's a pretty (er) solid clue as to where the
417+
* apparent bug must be.
414418
*
415419
* - A likely quick turnaround remedy would be a somewhat more involved
416420
* children state mapping, with actual `nodeId` lookup rather than the
@@ -419,11 +423,11 @@ describe('Tests ported from JavaRosa - repeats', () => {
419423
* - A more "correct" solution would almost certainly involve
420424
* understanding how any particular reactive access could cause these
421425
* states to go out of sync in the first place. It would likely also
422-
* involve some investigation into whether the discrepancy is temporary
423-
* and resolves after yielding to the event loop; this would implicate
424-
* some aspect of Solid's reactive scheduling, which most of our
425-
* reactive internals currently bypass (naively, trading CPU time for
426-
* testability of the reactive bridge implementation).
426+
* involve some investigation into whether the discrepancy is
427+
* temporary and resolves after yielding to the event loop; this would
428+
* implicate some aspect of Solid's reactive scheduling, which most of
429+
* our reactive internals currently bypass (naively, trading CPU time
430+
* for testability of the reactive bridge implementation).
427431
*/
428432
it.fails('updates relative repeat count, inside repeat', async () => {
429433
const scenario = await Scenario.init(
@@ -538,9 +542,11 @@ describe('Tests ported from JavaRosa - repeats', () => {
538542
/**
539543
* **PORTING NOTES**
540544
*
541-
* - Another `InconsistentChildrenStateError`, another clue! This case is
542-
* definitely triggered by the
543-
* {@link Scenario.removeRepeat} call.
545+
* - Another `InconsistentChildrenStateError`, another clue! ~~This
546+
* case is definitely triggered by the {@link Scenario.removeRepeat}
547+
* call.~~ This error goes away if we unwrap the
548+
* {@link https://github.com/getodk/web-forms/blob/d40bd88ed8959bbe7fae5d28efc840c16ca50a72/packages/scenario/src/jr/Scenario.ts#L163-L173 | `createMemo` call}
549+
* in Scenario.ts.
544550
* - Same thoughts on `nullValue()` -> blank/empty string check
545551
*/
546552
it.fails('updates that reference', async () => {
@@ -1600,8 +1606,11 @@ describe('Tests ported from JavaRosa - repeats', () => {
16001606
/**
16011607
* **PORTING NOTES**
16021608
*
1603-
* - Current failure is an `InconsistentChildrenStateError`, likely with
1604-
* similar root cause as other cases around repeat instance removal.
1609+
* - Current failure is an `InconsistentChildrenStateError` ~~, likely
1610+
* with similar root cause as other cases around repeat instance
1611+
* removal.~~ This error goes away if we unwrap the
1612+
* {@link https://github.com/getodk/web-forms/blob/d40bd88ed8959bbe7fae5d28efc840c16ca50a72/packages/scenario/src/jr/Scenario.ts#L163-L173 | `createMemo` call}
1613+
* in Scenario.ts.
16051614
*
16061615
* - - -
16071616
*

0 commit comments

Comments
 (0)