Skip to content
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

Two forms with a re-usable form definition "sometimes" leads to an incorrect form in one of the two #3881

Closed
joeribekker opened this issue Feb 14, 2024 · 2 comments · Fixed by #3991
Assignees
Labels
bug Something isn't working needs-backport Fix must be backported to stable release branch owner: utrecht
Milestone

Comments

@joeribekker
Copy link
Contributor

joeribekker commented Feb 14, 2024

We found this issue when figuring out why voorletters was suddenly not working in the prefill when migrating from 2.4.3 to 2.4.5.

The client said it didn't work. Made the initials field writable (it was readonly) so it could be filled, and saved the form (this step was a re-usable form definition). When we tested it, it worked. Silvia suggested it could be related to a variable not being created and it was then created when the form was saved, making the form function.

This might also be the case why a re-usable form definition works in form A but not in form B, after the form definition is changed in form A.

@joeribekker joeribekker added bug Something isn't working triage Issue needs to be validated. Remove this label if the issue considered valid. labels Feb 14, 2024
@sergei-maertens
Copy link
Member

Refinement: suspicion is that updating a form variable via form X does not result in the same update being saved on form variable in form Y that also happens to use the same reusable form definition.

Form variables are persisted in bulk in one transaction (variables_bulk_update).

Remarks: this is bigger than just the prefill-configuration being out of sync, it also affects logic, registration, e.g. when:

  • a variable is deleted
  • a variable is renamed

We have a warning in the frontend that says X number of forms will be affected by changing the reusable form definition. However, because prefill is configured on the component itself (and synced/copied to the variable), the impression is that this will automatically apply to all forms using this form definition and the warning does not absolve us from properly handling this.

So, we scope this to sychronizing variable configuration for this particular form definition (i.e. there is a match on form_definition FK, we nuke existing variables and recreate the new ones).

Tasks:

  • confirm this theory
  • if confirmed, synchronize form variables in other forms -> kick off celery task after variables_bulk_update and use the form_definition information of each variable to figure out which forms need to be updated.
  • take into account the submission variable recoupling too.

@sergei-maertens sergei-maertens added needs-backport Fix must be backported to stable release branch and removed triage Issue needs to be validated. Remove this label if the issue considered valid. labels Feb 19, 2024
@sergei-maertens
Copy link
Member

Backport label added - let's aim for this, but we should not compromise the fix/implementation to make it backportable. Manual fixing is possible, so needs-backport is to be nice to customers :)

@sergei-maertens sergei-maertens added this to the Release 2.6.0 milestone Feb 19, 2024
@vaszig vaszig self-assigned this Mar 1, 2024
vaszig added a commit that referenced this issue Mar 11, 2024
When there is a reusable definition and we update the form variables, we want
to kick off a celery task which will update all the forms which use the
same definition.
vaszig added a commit that referenced this issue Mar 12, 2024
When there is a reusable definition and we update the form variables, we want
to kick off a celery task which will update all the forms which use the
same definition.
vaszig added a commit that referenced this issue Mar 12, 2024
vaszig added a commit that referenced this issue Mar 13, 2024
vaszig added a commit that referenced this issue Mar 13, 2024
When there is a reusable definition and we update the form variables, we want
to kick off a celery task which will update all the forms which use the
same form definition.
sergei-maertens pushed a commit that referenced this issue Mar 13, 2024
When there is a reusable definition and we update the form variables, we want
to kick off a celery task which will update all the forms which use the
same form definition.
sergei-maertens added a commit that referenced this issue Mar 13, 2024
…usable-form-definition-may-be-incorrect

[#3881] Update variables in reusable form definitions
sergei-maertens pushed a commit that referenced this issue Mar 13, 2024
When there is a reusable definition and we update the form variables, we want
to kick off a celery task which will update all the forms which use the
same form definition.

Backport-of: #3991
sergei-maertens pushed a commit that referenced this issue Mar 13, 2024
When there is a reusable definition and we update the form variables, we want
to kick off a celery task which will update all the forms which use the
same form definition.

Backport-of: #3991
sergei-maertens pushed a commit that referenced this issue Mar 13, 2024
When there is a reusable definition and we update the form variables, we want
to kick off a celery task which will update all the forms which use the
same form definition.

Backport-of: #3991
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-backport Fix must be backported to stable release branch owner: utrecht
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants