Commit 7624fb1
Two runtime bugs in repeatable submission fields.
dedupeOperationEntries() collapsed duplicate patch operations only when they sat
next to each other in the body: it walked backwards, remembered the last index per
op+path, and spliced an entry out only when the remembered index was exactly one
ahead of it. After a reorder or a delete the operations for one field are no longer
adjacent, so stale operations survived into the PATCH and the value the user had
just removed or moved came back on save. It is rewritten to keep the latest
operation per op+path and drop every earlier one, which is what the two renamed
specs now say. The two specs previously asserted the stale first operation was
still in the body; both expected bodies lose that entry.
The dedupe key is op+path, which ignores a move's `from`. That is safe here for the
same reason it is safe on dtq-dev: this function only ever sees submission-form
operations, whose paths are bare or numeric-indexed metadata paths, never the JSON
Patch append form. The rewritten doc comment says so.
Second, form-builder.service.ts computed `place = controlModelIndex || value.place`
for object-valued controls. Index 0 is falsy, so the first entry of an array fell
through to whatever stale `place` the value carried. It now tests for the index
explicitly (hasArrayIndex), so position 0 keeps place 0. A new spec pins it.
v9 notes: the source commit also rewrites dynamic-form-array.component.ts and its
spec (66 of its 104 lines) to keep the FormArray in sync with the model on reorder.
Those two files are deliberately NOT ported. Vanilla 9.3 solves the same desync its
own way, with moveFormControlToPosition() (dynamic-form-array.component.ts:274),
and the file is byte-identical with dspace-9.3 on this branch; transplanting the
7.x mechanism (moveFormArrayGroup/getControlOfGroup, neither of which exists on v9)
would be a regression, and its spec tests exactly those absent methods.
`git diff origin/dtq-dev-9-base HEAD --stat -- .../models/array-group/` is empty.
The four ported files are hunk-identical with the source: for each of them
`git show 164c424 -- <f> | grep -E '^[-+][^-+]'` and the same grep over this
branch's diff produce byte-identical output.
Card PB-02 (tranche T3).
Source: 164c424 (dtq-dev PR #1267)
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 82c6caf commit 7624fb1
4 files changed
Lines changed: 50 additions & 54 deletions
File tree
- src/app
- core/json-patch
Lines changed: 2 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
344 | | - | |
| 344 | + | |
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
| |||
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | 411 | | |
430 | 412 | | |
431 | 413 | | |
| |||
466 | 448 | | |
467 | 449 | | |
468 | 450 | | |
469 | | - | |
| 451 | + | |
470 | 452 | | |
471 | 453 | | |
472 | 454 | | |
| |||
551 | 533 | | |
552 | 534 | | |
553 | 535 | | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | 536 | | |
573 | 537 | | |
574 | 538 | | |
| |||
Lines changed: 16 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
404 | 410 | | |
405 | 411 | | |
406 | 412 | | |
407 | 413 | | |
408 | 414 | | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
423 | 421 | | |
424 | | - | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
425 | 426 | | |
426 | 427 | | |
427 | 428 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
543 | 543 | | |
544 | 544 | | |
545 | 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 | + | |
546 | 576 | | |
547 | 577 | | |
548 | 578 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | | - | |
| 290 | + | |
| 291 | + | |
291 | 292 | | |
292 | 293 | | |
293 | 294 | | |
| |||
0 commit comments