Skip to content

Commit 92af60b

Browse files
committed
lsp: Instruct webview client not to cache content
1 parent 9da9516 commit 92af60b

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

lib/esbonio/changes/951.fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Rather than trying to generate unique urls across projects (which broke many links), the preview server now sets the `Cache-Control` header in an attempt to ensure the preview always updates correctly.

lib/esbonio/changes/987.fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Rather than trying to generate unique urls across projects (which broke many links), the preview server now sets the `Cache-Control` header in an attempt to ensure the preview always updates correctly.

lib/esbonio/esbonio/server/features/preview_manager/preview.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ def translate_path(self, path: str) -> str:
2525
# self.logger.debug("Translate: '%s' -> '%s'", path, result)
2626
return result
2727

28+
def end_headers(self):
29+
# Instruct the client not to cache the response.
30+
#
31+
# See: https://github.com/swyddfa/esbonio/issues/951
32+
# https://github.com/swyddfa/esbonio/issues/987
33+
self.send_header("Cache-Control", "no-store")
34+
return super().end_headers()
35+
2836
def log_message(self, format: str, *args: Any) -> None:
2937
self.logger.debug(format, *args)
3038

0 commit comments

Comments
 (0)