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

Fix required option in INJECT_* type form fields #852

Closed
wants to merge 6 commits into from

Conversation

TGyAkos
Copy link
Collaborator

@TGyAkos TGyAkos commented Jan 24, 2025

The current code will avoid saving the 'required' option as 'true', thereby avoiding the error message in the frontend saying, 'you need to fill out every required field'.

albi005 and others added 3 commits January 10, 2025 11:35
The current code will avoid saving the 'required' option as 'true', thereby avoiding the error message in the frontend saying, 'you need to fill out every required field'.
@TGyAkos TGyAkos requested review from Gerviba and Isti01 January 24, 2025 20:26
@TGyAkos TGyAkos self-assigned this Jan 24, 2025
@TGyAkos
Copy link
Collaborator Author

TGyAkos commented Jan 24, 2025

This likely the wrong solution to the problem at hand, sadly I could not come up with a better one yet, as I do not fully understand the dataflow between an Entity and its associated Page, and how to intercept that communication.

Any and every suggestion or critisim is more than welcome!

@TGyAkos TGyAkos linked an issue Jan 24, 2025 that may be closed by this pull request
This is a fix for already existing forms, which haven't been updated yet.
When editing an already existing form, this should also fix the 'required' option, on any already existing 'INJECT_' type fields.
@@ -27,6 +27,9 @@ export const AutoFormField = ({ fieldProps, control, disabled, submittedValue }:
else defaultValue = ''
}

if (fieldProps.type.startsWith('INJECT_'))
fieldProps.required = false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't mutate prop values in rendering code, introduce a new variable instead

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully fixed the issue!
Please check and advise

Hopefully resolves the following request by @Isti01:
'Don't mutate prop values in rendering code, introduce a new variable instead'
@Isti01
Copy link
Collaborator

Isti01 commented Feb 1, 2025

Already part of staging

@Isti01 Isti01 closed this Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove "required" option from INJECT_* field types in form component
3 participants