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

[4.x] Remove double-render of fields in Form tag #8861

Merged

Conversation

martyf
Copy link
Contributor

@martyf martyf commented Oct 18, 2023

In the Forms tag, when create is called, getSections and getFields are called to get the sections and fields respectively.

However, getSections already calls getFields. This results in getFields being called twice - meaning fields are being rendered twice.

This PR changes the behaviour of create and runs getSections first, as it currently does, and then checks to see if sections were returned - if so, it then extracts the fields from the sections (rather than calling getFields again). If there are no sections (i.e. think historical pre-section forms) then getFields is explicitly called.

@jasonvarga
Copy link
Member

Pretty sure that getSections is going to populate the fields regardless of what your blueprint looks like since it all gets normalized.

I think we can just assume sections will be good to go and you can pick the fields from there, rather than doing the condition.

I'll double check though.

@jasonvarga jasonvarga merged commit 8a1ba28 into statamic:4.x Oct 18, 2023
16 checks passed
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.

2 participants