fix(#7594): edit reports without duplicating their extra docs#11114
Open
benkags wants to merge 8 commits into
Open
fix(#7594): edit reports without duplicating their extra docs#11114benkags wants to merge 8 commits into
benkags wants to merge 8 commits into
Conversation
b2b1f02 to
3e2b1e2
Compare
3e2b1e2 to
624b437
Compare
| this.applyChangedFields(target[key], next[key], prev[key]); | ||
| return; | ||
| } | ||
| target[key] = _cloneDeep(next[key]); |
…g them Persist each db-doc child id into <_id> and recover it on edit from the previous fields; add a db-doc-edit attribute (link|readonly|recreate) with a type-based default.
…ence Overlay only the fields the parent user changed onto the live linked doc, and surface diverged fields via an out-accumulator the component folds into its post-save snackbar.
Add /local/ to .gitignore so personal scratch files do not appear in git status.
Remove the divergence notification and its plumbing (interface, accumulator, snackbar key, helpers); the per-field merge still preserves independent edits silently.
…c child Stop reserving _attachments; merge them last-writer-wins per name so binary uploads on linked children reach the child doc instead of being silently dropped.
Remove the legacy `recreate` option (mint a new child every save) from DbDocEdit; unknown attribute values now fall back to the type-based default with a console warn.
624b437 to
aeaf3c1
Compare
Contributor
Author
|
@dianabarsan @jkuester this is ready for review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Editing a report created with
db-doc="true"extra-document sections used to duplicate every extra doc on each save. This PR fixes the duplication and adds a policy that lets form authors choose how extra docs behave on edit.db-docchild's id is now written into a direct<_id>node inside its section, so it serialises intodoc.fieldsand recovered on edit.db-doc-editattribute. New attributelink | readonlylets the form author declare intent, with a safe type-based default: non-contacts default tolink(the report owns the data), contacts toreadonly(they have their own editor). Authored via aninstance::db-doc-editXLSForm column — no cht-conf change needed.Fixes #7594
Code review checklist
db-doc-editXLSForm authoring guidance.enketo.service.spec.ts(links/readonly/recreate, repeat-matched ids, per-field merge, attachment overlay),form.service.spec.tsandreports-add.component.spec.ts; the existingpregnancy-complete-a-delivery.wdio-spec.jse2e is updated to assert ids are reused on edit.<_id>still work — their first edit duplicates once (no id to recover yet), then stabilises on subsequent edits. No migration.recreatereproduces the pre-fix behaviour exactly for forms that want it.