Skip to content

Commit 81b1b24

Browse files
authored
Remove deprecated support for [data-turbo-cache="false"] (#1470)
This deprecation was originally introduced in [e013072][], which was part of the [v7.3.0][] release. [e013072]: e013072 [v7.3.0]: https://github.com/hotwired/turbo/releases/tag/v7.3.0
1 parent 9a79b30 commit 81b1b24

File tree

3 files changed

+1
-28
lines changed

3 files changed

+1
-28
lines changed

src/observers/cache_observer.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export class CacheObserver {
22
selector = "[data-turbo-temporary]"
3-
deprecatedSelector = "[data-turbo-cache=false]"
43

54
started = false
65

@@ -25,18 +24,6 @@ export class CacheObserver {
2524
}
2625

2726
get temporaryElements() {
28-
return [...document.querySelectorAll(this.selector), ...this.temporaryElementsWithDeprecation]
29-
}
30-
31-
get temporaryElementsWithDeprecation() {
32-
const elements = document.querySelectorAll(this.deprecatedSelector)
33-
34-
if (elements.length) {
35-
console.warn(
36-
`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`
37-
)
38-
}
39-
40-
return [...elements]
27+
return [...document.querySelectorAll(this.selector)]
4128
}
4229
}

src/tests/fixtures/cache_observer.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<section>
1111
<h1>Cache Observer</h1>
1212
<div id="temporary" data-turbo-temporary>data-turbo-temporary</div>
13-
<div id="temporary-with-deprecated-selector" data-turbo-cache="false">data-turbo-cache=false</div>
1413
<p><a id="link" href="/src/tests/fixtures/rendering.html">rendering</a></p>
1514
<p><a id="redirect-here-link" href="/__turbo/redirect?path=/src/tests/fixtures/cache_observer.html">Redirection link back to here</a></p>
1615
</section>

src/tests/functional/cache_observer_tests.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,6 @@ test("removes temporary elements", async ({ page }) => {
1515
assert.notOk(await hasSelector(page, "#temporary"))
1616
})
1717

18-
test("removes temporary elements with deprecated turbo-cache=false selector", async ({ page }) => {
19-
await page.goto("/src/tests/fixtures/cache_observer.html")
20-
21-
assert.equal(await page.textContent("#temporary-with-deprecated-selector"), "data-turbo-cache=false")
22-
23-
await page.click("#link")
24-
await nextBody(page)
25-
await page.goBack()
26-
await nextBody(page)
27-
28-
assert.notOk(await hasSelector(page, "#temporary-with-deprecated-selector"))
29-
})
30-
3118
test("following a redirect renders [data-turbo-temporary] elements before the cache removes", async ({ page }) => {
3219
await page.goto("/src/tests/fixtures/navigation.html")
3320
await page.click("#redirect-to-cache-observer")

0 commit comments

Comments
 (0)