IBX-3075: Switched to loading all choices at once for ContentCreate form #950
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
JIRA: https://issues.ibexa.co/browse/IBX-3075
Please look at the JIRA ticket to learn more about this issue - there's a reproducer that I've used to test that with my changes it doesn't occur anymore.
This is the most common issue triggering Behat failures (because we run the tests in parallel) and that's why I've started investigating it.
Without this change the
ContentCreateContentTypeChoiceLoader::loadChoiceList
method is called 6 times (looks like the Form is created 2 times and there are 3 calls per Form).After this change the call is made 2 times (once per Form).
This is my first interaction with the Form component - so while I was able to see what's going on (my diagnosis: for a single Form the
ContentCreateContentTypeChoiceLoader::loadChoices
method is called multiple times - and because the Content Types are changed in the background there is a mismatch between values returned from the calls made for single Form) I'm not sure if this is the right solution. From what I've read in the doc it doesn't look like we're filtering the values in a way that's benefiting from lazy loading them (but I might be wrong 😄 ) and using the ChoiceLoader might not be necessary here.I've attached the Blackfire profiles (before and after) in the Jira ticket - so you can verify the number of calls I've mentioned.
TODO: