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

Draft preview links don't work #48

Closed
jgl221 opened this issue Sep 2, 2016 · 10 comments
Closed

Draft preview links don't work #48

jgl221 opened this issue Sep 2, 2016 · 10 comments

Comments

@jgl221
Copy link

jgl221 commented Sep 2, 2016

With the latest release, Draft tokenized links don't display correctly (or maybe this has always been the case?). If I save an existing entry as a draft and make edits to the draft, when I click the arrow to take me to the tokenized draft link, the changes that we make aren't displayed there and instead displays the current live version. Live Preview works just fine on the Drafts though and when I publish the Draft, the changes that I made in it do overwrite the existing version so that is working as well.

Unfortunately our clients do use the Draft mode quite frequently to get feedback and approval for changes and new layouts for their pages, so we've had to hack up a couple workarounds to that that aren't ideal (duplicate entry, disable the duplicated entry, make edits, and use that link to share out -- disabled entries that have tokenized URLs work just fine with edits/changes).

I took a look at the closed issues and saw that there was another issue relating to Drafts but that seems to have been fixed? So I believe this one is different however I could be wrong.

Thanks so much, other than this small issue we are loving Neo and hope that the Craft team can make it part of the core build at some point!

@benjamminf
Copy link
Contributor

Hey @jgl221 thanks for the report. I was able to reproduce the issue and found out why this was happening. Similar situation to #21 so it's actually a problem with Craft's built-in Matrix field too (although you wouldn't usually run into this problem with Matrix as you don't need to filter by level).

Simple enough solution so I've gone ahead and fixed it already. I'll be releasing a new version today at some point with the fix 👍

@benjamminf benjamminf changed the title Drafts don't work Draft preview links don't work Sep 4, 2016
@jgl221
Copy link
Author

jgl221 commented Sep 6, 2016

That's great, thank you for the quick response and fix! My clients will be very happy :)

@benjamminf
Copy link
Contributor

No problem! I haven't made the release yet as I've fixed some issues relating to localisation that I want to test thoroughly before it's available. If you can't wait any longer, grab the neo/models/Neo_CriteriaModel.php file from the dev branch and replace the existing one on your site. This will fix your issue.

@jgl221
Copy link
Author

jgl221 commented Sep 6, 2016

I grabbed the updated file from the dev branch and it's mostly working but seems to have one other caveat. Top-level blocks that I modify are updating on the Draft, but changes to child blocks aren't updating. Live Preview is again still working though. I imagine we're just missing a loop to go through modified child blocks on Draft mode? Or maybe it's something more complex?

@benjamminf
Copy link
Contributor

benjamminf commented Sep 6, 2016

Unfortunately it's a lot more complex than that. Does it work correctly with live preview with child blocks?

If it does, I will find it a little strange that live preview would work but not drafts, since it's the same code running in both situations. Otherwise I probably missed something somewhere...

@jgl221
Copy link
Author

jgl221 commented Sep 7, 2016

Perhaps I oversimplified it just a tad :)

But yes, Live Preview is working fine with both top-level and child block modifications. I thought maybe it had to do with caching or locale, but even with caching and locales turned off, I'm still seeing the same behavior where the Live Preview is showing the modifications on child blocks on drafts, but the draft token link when saved doesn't display the changes.

@benjamminf
Copy link
Contributor

Haha no it's a fair assumption, but it turns out how Live Preview (and Drafts) work in Craft is fundamentally flawed and it's taken quite a large amount of effort to get Neo to work around this problem. Clearly it's harder than I thought, as I'm still receiving issue reports relating to it.

Thanks for the clarification. I'll see what I can do, but I won't lie it's a little confusing. I'll keep this thread updated.

@jgl221
Copy link
Author

jgl221 commented Sep 7, 2016

Thanks @benjamminf I appreciate your help! I don't doubt that it's very complicated, especially so if the fundamental way they work in Craft is wonky already.

@benjamminf
Copy link
Contributor

Good news, I figured it out :) Turns out I just missed some checks when adding in support for draft preview links. New version of Neo to be released over the weekend (probably).

@jgl221
Copy link
Author

jgl221 commented Sep 9, 2016

You're the tops! Thanks so much for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants