@foldkit/vite-plugin 0.4.0 → 0.4.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,MAAM,EAAkC,MAAM,MAAM,CAAA;AAGlE,6CAA6C;AAC7C,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IAC1C;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAC,CAAA;AAofF,eAAO,MAAM,OAAO,GAAI,UAAS,oBAAyB,KAAG,MAgC5D,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,MAAM,EAAkC,MAAM,MAAM,CAAA;AAGlE,6CAA6C;AAC7C,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IAC1C;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAC,CAAA;AA4fF,eAAO,MAAM,OAAO,GAAI,UAAS,oBAAyB,KAAG,MAgC5D,CAAA"}
package/dist/index.js CHANGED
@@ -69,10 +69,14 @@ const encodeResponseFrameJson = S.encodeUnknownSync(S.fromJsonString(ResponseFra
69
69
  // HANDLERS
70
70
  const handlePreserveModelReceived = (state, payload) => Exit.match(S.decodeUnknownExit(PreserveModelMessage)(payload), {
71
71
  onFailure: error => Console.warn('[foldkit:hmr] failed to decode preserve-model payload', error),
72
- onSuccess: ({ id, model }) => {
73
- const entry = { model, isHmrReload: false };
74
- return Ref.update(state.preservedModels, HashMap.set(id, entry));
75
- },
72
+ onSuccess: ({ id, model, isHmrReload }) => Ref.update(state.preservedModels, current => {
73
+ const existingFlag = Option.exists(HashMap.get(current, id), ({ isHmrReload }) => isHmrReload);
74
+ const entry = {
75
+ model,
76
+ isHmrReload: isHmrReload === true || existingFlag,
77
+ };
78
+ return HashMap.set(current, id, entry);
79
+ }),
76
80
  });
77
81
  const handleRequestModelReceived = (server, state, payload) => Exit.match(S.decodeUnknownExit(RequestModelMessage)(payload), {
78
82
  onFailure: error => Console.warn('[foldkit:hmr] failed to decode request-model payload', error),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foldkit/vite-plugin",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Vite plugin for Foldkit hot module reloading with state preservation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -28,7 +28,7 @@
28
28
  "effect": "4.0.0-beta.59",
29
29
  "typescript": "^6.0.2",
30
30
  "vite": "^7.3.1",
31
- "foldkit": "0.82.0"
31
+ "foldkit": "0.82.8"
32
32
  },
33
33
  "keywords": [
34
34
  "vite",