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

[main branch] Cache is incorrect when navigating using promoted frames #643

Closed
manuelpuyol opened this issue Jul 20, 2022 · 4 comments · Fixed by #644
Closed

[main branch] Cache is incorrect when navigating using promoted frames #643

manuelpuyol opened this issue Jul 20, 2022 · 4 comments · Fixed by #644

Comments

@manuelpuyol
Copy link
Contributor

Looks like this was introduced by #431

Testing in 1811189 (last PR merged before 431):

Screen.Recording.2022-07-20.at.3.53.15.PM.mov

Testing in 837e977:

Screen.Recording.2022-07-20.at.3.56.43.PM.mov
@manuelpuyol
Copy link
Contributor Author

cc @seanpdoyle in case you have any idea why this changed after #431

@seanpdoyle
Copy link
Contributor

@manuelpuyol thank you for opening this. Does this test re-create your test case?

test("test promoted frame navigations are cached", async ({ page }) => {
  await page.goto("/src/tests/fixtures/tabs.html")

  await await page.click("#tab-2")
  await nextEventNamed(page, "turbo:frame-render")

  assert.equal(await page.textContent("#tab-content"), "Two")

  await page.click("#tab-3")
  await nextEventNamed(page, "turbo:frame-render")

  assert.equal(await page.textContent("#tab-content"), "Three")

  await page.goBack()
  await nextBeat()

  assert.equal(await page.textContent("#tab-content"), "Two")

  await page.goBack()
  await nextBeat()

  assert.equal(await page.textContent("#tab-content"), "One")
})

@manuelpuyol
Copy link
Contributor Author

yes!

seanpdoyle added a commit to seanpdoyle/turbo that referenced this issue Jul 20, 2022
Closes hotwired#643

First, rename the `FrameRendererDelegate.frameExtracted` callback method
to `willRenderFrame`, then pass along both the _current_ frame and the
_new_ frame as arguments.

Next, in the `FrameController.willRenderFrame` callback, assign the
`previousFrameElement` property (used elsewhere in the
`visitCachedSnapshot` callback) to contain the contents of the _current_
frame, instead of the _new_ frame.
@seanpdoyle
Copy link
Contributor

I've opened #644 to try and resolve this.

@dhh dhh closed this as completed in #644 Jul 28, 2022
dhh pushed a commit that referenced this issue Jul 28, 2022
Closes #643

First, rename the `FrameRendererDelegate.frameExtracted` callback method
to `willRenderFrame`, then pass along both the _current_ frame and the
_new_ frame as arguments.

Next, in the `FrameController.willRenderFrame` callback, assign the
`previousFrameElement` property (used elsewhere in the
`visitCachedSnapshot` callback) to contain the contents of the _current_
frame, instead of the _new_ frame.
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