From 87b0efbc1079c0c065d512a55fb001295feb003e Mon Sep 17 00:00:00 2001 From: Marco Roth Date: Mon, 18 Jul 2022 16:58:59 -0400 Subject: [PATCH] Deprecate `Turbo.clearCache()` (#634) `Turbo.clearCache()` is deprecated in favor of `Turbo.cache.clear()` Related: https://github.com/hotwired/turbo/pull/632 --- src/core/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/index.ts b/src/core/index.ts index 7c989a6e7..72e111453 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -97,8 +97,13 @@ export function renderStreamMessage(message: StreamMessage | string) { /** * Removes all entries from the Turbo Drive page cache. * Call this when state has changed on the server that may affect cached pages. + * + * @deprecated since version 7.2.0 in favor of `Turbo.cache.clear()` */ export function clearCache() { + console.warn( + "Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`" + ) session.clearCache() }