@rip-lang/ui 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/serve.rip +5 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rip-lang/ui",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Zero-build reactive web framework — rip.js + ui.rip + launch(url)",
5
5
  "type": "module",
6
6
  "main": "ui.rip",
package/serve.rip CHANGED
@@ -75,7 +75,11 @@ export ripUI = (opts = {}) ->
75
75
  if appState
76
76
  data[k] = v for k, v of appState
77
77
 
78
- new Response JSON.stringify({ components, data }), headers: { 'Content-Type': 'application/json', 'Cache-Control': 'no-store' }
78
+ json = JSON.stringify({ components, data })
79
+ etag = "W/\"#{Bun.hash(json).toString(36)}\""
80
+ if c.req.header('if-none-match') is etag
81
+ return new Response(null, { status: 304 })
82
+ new Response json, headers: { 'Content-Type': 'application/json', 'Cache-Control': 'no-store', 'ETag': etag }
79
83
 
80
84
  # ----------------------------------------------------------------------------
81
85
  # Register watch directories with rip-server via control socket