hotwired / turbo

The speed of a single-page web application without having to write any JavaScript
https://turbo.hotwired.dev
MIT License
6.65k stars 421 forks source link

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

Closed manuelpuyol closed 2 years ago

manuelpuyol commented 2 years ago

Looks like this was introduced by https://github.com/hotwired/turbo/pull/431

Testing in 1811189 (last PR merged before 431):

https://user-images.githubusercontent.com/11280312/180080282-b274d87f-6288-467f-9937-a84590da182e.mov

Testing in 837e977:

https://user-images.githubusercontent.com/11280312/180081033-81d88847-feea-42d2-bcbc-da432be21483.mov

manuelpuyol commented 2 years ago

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

seanpdoyle commented 2 years ago

@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 commented 2 years ago

yes!

seanpdoyle commented 2 years ago

I've opened https://github.com/hotwired/turbo/pull/644 to try and resolve this.