rwsdk 1.0.0-beta.9-test.20251008025236 → 1.0.0-beta.9-test.20251008035247
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.
|
@@ -16,7 +16,27 @@ REQUEST_INFO_KEYS.forEach((key) => {
|
|
|
16
16
|
configurable: false,
|
|
17
17
|
get: function () {
|
|
18
18
|
const store = requestInfoStore.getStore();
|
|
19
|
-
|
|
19
|
+
if (store) {
|
|
20
|
+
return store[key];
|
|
21
|
+
}
|
|
22
|
+
// context(justinvdm, 2025-10-08): During a chaotic HMR update, the async
|
|
23
|
+
// context (store) can be torn down while a request is in-flight. If this
|
|
24
|
+
// happens, we return an empty object for context properties instead of
|
|
25
|
+
// undefined. This prevents a hard crash when middleware (like setupDb)
|
|
26
|
+
// tries to set a property on the context of an already-orphaned request.
|
|
27
|
+
if (key === "ctx" || key === "__userContext") {
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
},
|
|
32
|
+
set: function (value) {
|
|
33
|
+
const store = requestInfoStore.getStore();
|
|
34
|
+
// context(justinvdm, 2025-10-08): Only set the value if the store exists.
|
|
35
|
+
// If it doesn't, this is a no-op, which is the desired behavior for an
|
|
36
|
+
// orphaned request.
|
|
37
|
+
if (store) {
|
|
38
|
+
store[key] = value;
|
|
39
|
+
}
|
|
20
40
|
},
|
|
21
41
|
});
|
|
22
42
|
});
|
package/package.json
CHANGED