From 4b974a387e818c3c46e070d0e3d772e7aea07d04 Mon Sep 17 00:00:00 2001 From: tleish Date: Sun, 23 Jun 2024 19:21:19 -0600 Subject: [PATCH] fix #1241 - cache current page with frame updated --- src/core/frames/frame_controller.js | 4 +++- src/tests/functional/frame_navigation_tests.js | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/frames/frame_controller.js b/src/core/frames/frame_controller.js index 07764fc86..b51631768 100644 --- a/src/core/frames/frame_controller.js +++ b/src/core/frames/frame_controller.js @@ -270,6 +270,8 @@ export class FrameController { viewRenderedSnapshot(_snapshot, _isPreview, _renderMethod) {} + setLastRenderedLocation() {} + preloadOnLoadLinksForView(element) { session.preloadOnLoadLinksForView(element) } @@ -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; const response = { statusCode, redirected, responseHTML } const options = { response, diff --git a/src/tests/functional/frame_navigation_tests.js b/src/tests/functional/frame_navigation_tests.js index 75b53bf49..d4d3cbf51 100644 --- a/src/tests/functional/frame_navigation_tests.js +++ b/src/tests/functional/frame_navigation_tests.js @@ -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]") + + 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]") })