-
Notifications
You must be signed in to change notification settings - Fork 66
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
Live Preview not updating with Neo field #21
Comments
Thanks man, appreciate it! I think I may have found your problem. Looking at the source for Try this instead: {% cache unless craft.config.devMode or craft.request.isLivePreview %}
{% include '_content' %}
{% endcache %} |
Thanks for the quick reply and suggestion. I tried it out (updated in the demo site, and cleared cache). But still running into the same problem. It's weird because it's only the Neo field that doesn't get updated. Trying the following without saving or refreshing the entry:
|
Monitoring the console, I can see changes to the Neo field are being detected, as AJAX requests are being sent to the server to update the preview. The fact that the Neo field updates after saving still leads me to believe it still might be a caching problem, since caches get cleared after saving an element, so it fits the behaviour. Although I admit with the added live preview check, I don't understand how it could still be a problem. I know it's probably annoying, but do you think you could try removing the cache tags to see what happens? |
Okay so I've set up a local version of the site, and removing the cache tags doesn't solve the problem. I'm going to have a play around with it then get back to you. |
Seems you've discovered a bug with Neo! Live preview fails when you modify the element criteria model on the field. Removing the |
Not only that, you've discovered a bug with Craft's Matrix field too! Seems it has the same issue. I might go open a bug report with them. |
That's super interesting. I think it must be related to that issue I mentioned in the original post above… having similar trouble with Matrix when eager loading was applied. I ended up removing eager loading in Live Preview to get to work. Must have been related to the |
Yeah that's probably what it was. Looking into this issue... this is not an easy fix. All you can do when preparing criteria models for live preview is manually pass the blocks with it. All the filtering done by the element criteria model is done against the database, which explains why it doesn't live update. I wonder if P&T already know about this issue, and have just ignored it since it would require a pretty big rearchitecture of their element criteria model. I know they're ditching it in Craft 3 for a newer approach called Element Query, so maybe they'll fix it then. In the meantime, I'm going to look for ways around this. For simpler, common filters like |
I was afraid of something like that. Getting it to work around Hopefully they fix it in 3.0. :) |
Good news! I managed to figure out a pretty clean workaround. I have the |
I'm calling this done for now. I've implemented everything in the current API except for This will be available in the next release, which |
Fantastic. Work perfectly for me. Thank you! |
Dang it. Looks like a recent Craft update breaks Live Preview and Neo again. This time top level blocks are updated, but children aren't. Neo works fine in Craft v2.6.2791 When I update to v2.6.2794 (and v2.6.2793), Neo stops live previewing. Tried in multiple installs. Also tried different Neo versions in both v2.6.2791 and v2.6.2794 with same results. :( |
@louderthan10 Alright fixed it. It was a minor change to their element criteria model that resulted in this bug. They had changed the |
Wicked. Thanks! |
|
Update: I replaced the file mentioned earlier and it works. Assumed it would had already been merged in as it was a while ago. Is there a new version planned soon? Or has development halted until Craft 3 is released? |
@shealan There has been 1.4.0 on the master branch without an official release since late last year, but it had a bug with the Neo-to-Matrix conversion feature that I only just got around to fixing. Since then I've fixed a number of issues, most of which have been pushed to the master branch, which would explain why it's probably working for you now. I'm releasing a 1.4.1 version very soon. Since late last year life has essentially caused my OS work to come to a complete halt. I'm just starting to get back into regular development again, but I think soon most of my time will be spent on the Craft 3 rebuild of the plugin. |
@benjamminf thanks for the update. Your work is really appreciated. Looking forward to seeing the Craft 3 update! |
Had the same problem with live preview on craft-neo 1.41. Disabling eager loading explicitly for the preview helped:
|
First. This plugin changes everything. So well done. Thank you!
I've just built a pretty robust Neo-based install using our internal Live Wires prototyping library. It works amazingly well, there' just one small hitch we're running into… Live Preview doesn't refresh when editing the Neo field.
Possibly related: I had the same issue with another Craft install with the Matrix field when Eager-loading was implemented. Removing eager-loading helped. Same issue as this: http://craftcms.stackexchange.com/questions/8879/issue-with-matrix-type-property-and-live-preview
Not sure if it's just the sheer size of this field, or something else.
Feel free to try out the install for yourself (auto resets every night): http://demo.livewires.io/admin u:admin p:password)
Also here's the repo if you want to see the code used: https://github.com/louderthanten/craft-editorial-system (this field uses the _content.html file and _content folder to render the field).
The text was updated successfully, but these errors were encountered: