-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Eager loading and Live Preview #2335
Comments
Workaround !
|
@brandonkelly This wasn't fixed, was it? |
It is expected behavior, per the Eager-Loading docs:
(Example uses assets, but the behavior applies to all element types.) |
I know about the |
Sorry, was on a different train of thought I guess 🙃 Live Preview will preload each of your field values based on the POST data, but eager-loading will override those values with the eager-loaded values. So as @H-i-red’s workaround demonstrates, if it’s a Live Preview request you should just avoid eager-loading anything. |
Wow. Is there any way to generally disable eager-loading during Live Preview, or should there be?? |
Problem is, if the template is telling Craft to eager-load elements, then the template should also have adjusted following code to treat those field values like arrays (as they will be if they've been eager-loaded. So we can't just disable eager-loading for LP requests, as that will likely cause other errors further down the template. |
Ok, and I had thought of @H-i-red 's solution before seeing it, which will do what you know I'm interested in, and will have to be standard practice anyway. Thanks, @brandonkelly |
There should be a warning in the Eager Loading docs with instruction how to best write the conditional to avoid code duplication. |
Description
Live preview does not seem to work when I "Eager load" a matrix field.
Additional info
The text was updated successfully, but these errors were encountered: