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

Objects API prefill configuration copy button doesn't work #4859

Closed
stevenbal opened this issue Nov 26, 2024 · 0 comments · Fixed by #4902
Closed

Objects API prefill configuration copy button doesn't work #4859

stevenbal opened this issue Nov 26, 2024 · 0 comments · Fixed by #4902

Comments

@stevenbal
Copy link
Contributor

Product versie / Product version

latest

Customer reference

No response

Omschrijf het probleem / Describe the bug

The copy button in the Objects API prefill form doesn't work if the API group is changed by the copy action.

If this is my registration config:

image

And I add a new user defined variable and configure prefill:
60cQUGu0GA

Only the API group is set correctly, and the rest of the values are the defaults, not the correct values. This is due to the fact that the copy button sets the API group, which triggers a reset of the other fields after setting them. Currently the copy button only works if the API group remains the same

Stappen om te reproduceren / Steps to reproduce

  1. Create a Form
  2. Add Objects API registration backend and select non default values
  3. Add user defined variable
  4. Configure prefill and copy from registration

Verwacht gedrag / Expected behavior

Setting the api group should not reset the other values after copying

Screen resolution

None

Device

None

OS

None

Browser

No response

@stevenbal stevenbal added bug triage Issue needs to be validated. Remove this label if the issue considered valid. labels Nov 26, 2024
@sergei-maertens sergei-maertens added this to the Release 3.0 milestone Nov 27, 2024
@joeribekker joeribekker added topic: product-prefill and removed triage Issue needs to be validated. Remove this label if the issue considered valid. labels Dec 2, 2024
@sergei-maertens sergei-maertens moved this from Todo to In Progress in Development Dec 8, 2024
sergei-maertens added a commit that referenced this issue Dec 11, 2024
It's obsolete now we're using react-select. The react-select component
does accurately reflect the state of option selection, even if no
value is selected while leaving the select blank is not allowed.
sergei-maertens added a commit that referenced this issue Dec 11, 2024
sergei-maertens added a commit that referenced this issue Dec 11, 2024
Handling the reset of dependent fields in the ObjectTypeSelect
component is too naive - there's no guarantee that the fields must
always be reset, for example with the copy-config-from-registration
button. Clicking that button updates a bunch of form state at once,
and it already manages the dependent fields.

So, providing a callback to handle the reset allows us to handle the
dependent fields still, while having to option to incorporate extra
context.
sergei-maertens added a commit that referenced this issue Dec 11, 2024
The toggle is not displayed if there are no backends to copy from, so
the UI can be de-cluttered.

Additionally, the mechanism/slot for the extra controls has been
refactored to be more generic - anything can now be rendered there that
may be relevant, and the state is specific to the UI being rendered so
that has been removed from the generic parent component.

We use the formik status to track form-specific state, through a small
hook that normalizes the shape of the status (since it can be anything).
@sergei-maertens sergei-maertens moved this from In Progress to Implemented in Development Dec 11, 2024
@github-project-automation github-project-automation bot moved this from Implemented to Done in Development Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants