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

data-turbo-preview not working in beta.4 #159

Closed
vwong opened this issue Feb 4, 2021 · 3 comments · Fixed by #162
Closed

data-turbo-preview not working in beta.4 #159

vwong opened this issue Feb 4, 2021 · 3 comments · Fixed by #162

Comments

@vwong
Copy link

vwong commented Feb 4, 2021

In beta.4, the attribute data-turbo-preview is never present on document.documentElement even when visiting a cached page. It was working fine in beta.3.

For example, I create a Stimulus controller as follows. Whenever I visit a cached page in beta.3, I would get true followed by false. But in beta.4, I would get false twice.

import { Controller } from "stimulus"

export default class extends Controller {
  connect () {
    console.log(document.documentElement.hasAttribute("data-turbo-preview"))
  }
}

The caching mechanism itself works fine though.

seanpdoyle added a commit to seanpdoyle/turbo that referenced this issue Feb 6, 2021
Closes hotwired#117
Closes hotwired#159

---

When restoring from a cached snapshot, pass along the `isPreview` flag
to `View.renderPage`.

Also, always issue the request within `Visit.issueRequest`, since
process of restoring the cached preview is initiated prior to the
request intended to re-fetch the cached content.
@seanpdoyle
Copy link
Contributor

@vwong thank you for opening this.

Is the behavior restored by #162?

seanpdoyle added a commit to seanpdoyle/turbo that referenced this issue Feb 7, 2021
Closes hotwired#117
Closes hotwired#159

---

When restoring from a cached snapshot, pass along the `isPreview` flag
to `View.renderPage`.
@vwong
Copy link
Author

vwong commented Feb 7, 2021

@seanpdoyle Yep, that did it. Looking forward to the fix released. Thanks!

@seanpdoyle
Copy link
Contributor

I believe this was fixed as part of #169, which shared implementation change overlap with #162.

seanpdoyle added a commit to seanpdoyle/turbo that referenced this issue Feb 10, 2021
Closes hotwired#117
Closes hotwired#159

---

When restoring from a cached snapshot, pass along the `isPreview` flag
to `View.renderPage`.
seanpdoyle added a commit to seanpdoyle/turbo that referenced this issue Apr 9, 2021
Closes hotwired#117
Closes hotwired#159

---

While the original implementation change for this commit was covered
elsewhere, there is still value in the tests to add coverage for the
behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants