-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Afform - Fix broken prefill functionality #27121
Conversation
Thank you for contributing to CiviCRM! ❤️ We will need to test and review the PR. 👷 Introduction for new contributors
Quick links for reviewers |
Before: Index was ignored so only the first entity in an af-repeat set could be autofilled After: Index handled correctly
Before: Objects overwritten, breaking references and causing endless loops After: Objects merged correctly
This regressed in e2c263c
1d27a34
to
3c52227
Compare
I tested this on my local and was able to replicate the issue and confirmed this fixed the problem |
@colemanw, @seamuslee001 Use case : a form showing a family (parents and all their children). Behaviour on 5.66.alpha 1: EDIT : Individual 1 show only 1 child, although it is set as repeating and the relation is correctly created. Homer is the current user, and parent of 2 children. Here we should see 2 children, not just one. And also Marge as the second parent |
@GitHub-user-29 thanks for the detailed description and screenshots. Can you review this fix: #27615 |
Overview
Fixes multiple bugs when autocompleting an existing entity.
Before
After
Fixed
Comments
Simplest way to reproduce the bug is to make a new form with all the defaults, enable "Repeat" for Individual1 (top-right of the fieldset in the layout) and drag in "Existing Contact" field to Individual1.
Give the form a title and url, save, and try out the form. As soon as you try to autocomplete a contact it enters an endless js loop.
Refresh the form to see the other bug: Click the "+ Add" button and try to autocomplete the 2nd contact. It will fill the wrong one (also enter another endless loop).