Skip to content

Commit

Permalink
fix hotwired#1241 - cache current page with frame updated
Browse files Browse the repository at this point in the history
  • Loading branch information
tleish committed Jun 24, 2024
1 parent c4d3fd8 commit 4b974a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/core/frames/frame_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ export class FrameController {

viewRenderedSnapshot(_snapshot, _isPreview, _renderMethod) {}

setLastRenderedLocation() {}

preloadOnLoadLinksForView(element) {
session.preloadOnLoadLinksForView(element)
}
Expand Down Expand Up @@ -349,7 +351,7 @@ export class FrameController {
frame.delegate.fetchResponseLoaded = async (fetchResponse) => {
if (frame.src) {
const { statusCode, redirected } = fetchResponse
const responseHTML = await fetchResponse.responseHTML
const responseHTML = document.documentElement.outerHTML;

Check failure on line 354 in src/core/frames/frame_controller.js

View workflow job for this annotation

GitHub Actions / build

Extra semicolon
const response = { statusCode, redirected, responseHTML }
const options = {
response,
Expand Down
5 changes: 4 additions & 1 deletion src/tests/functional/frame_navigation_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,11 @@ test("promoted frame navigations are cached", async ({ page }) => {
assert.equal(await page.textContent("#tab-content"), "Two")
assert.equal(pathname((await page.getAttribute("#tab-frame", "src")) || ""), "/src/tests/fixtures/tabs/two.html")
assert.equal(await page.getAttribute("#tab-frame", "complete"), "", "caches two.html with [complete]")

Check failure on line 120 in src/tests/functional/frame_navigation_tests.js

View workflow job for this annotation

GitHub Actions / build

Trailing spaces not allowed
await page.goBack()
await nextEventNamed(page, "turbo:load")


assert.equal(await page.textContent("#tab-content"), "One")
assert.equal(await page.getAttribute("#tab-frame", "src"), null, "caches one.html without #tab-frame[src]")
assert.equal(await page.getAttribute("#tab-frame", "complete"), null, "caches one.html without [complete]")
})

0 comments on commit 4b974a3

Please sign in to comment.