@warp-drive/core 5.7.0-alpha.21 → 5.7.0-alpha.22

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.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { a as cloneResponseProperties, I as IS_CACHE_HANDLER, b as assertValidRe
3
3
  import { macroCondition, getGlobalConfig } from '@embroider/macros';
4
4
  import { w as waitFor } from "./configure-B48bFHOl.js";
5
5
  import { peekUniversalTransient, setUniversalTransient } from './types/-private.js';
6
- export { C as CacheHandler, S as Store, r as recordIdentifierFor, M as setIdentifierForgetMethod, K as setIdentifierGenerationMethod, N as setIdentifierResetMethod, L as setIdentifierUpdateMethod, O as setKeyInfoForResource, s as storeFor } from "./request-state-glkInb2R.js";
6
+ export { C as CacheHandler, S as Store, r as recordIdentifierFor, M as setIdentifierForgetMethod, K as setIdentifierGenerationMethod, N as setIdentifierResetMethod, L as setIdentifierUpdateMethod, O as setKeyInfoForResource, s as storeFor } from "./request-state-55umD7hP.js";
7
7
  import '@ember/debug';
8
8
  import './utils/string.js';
9
9
  import "./symbols-sql1_mdx.js";
package/dist/reactive.js CHANGED
@@ -1,5 +1,5 @@
1
- import { F as ReactiveResource, G as isNonIdentityCacheableField, H as getFieldCacheKeyStrict, r as recordIdentifierFor, z as withSignalStore } from "./request-state-glkInb2R.js";
2
- export { I as checkout, J as commit } from "./request-state-glkInb2R.js";
1
+ import { F as ReactiveResource, G as isNonIdentityCacheableField, H as getFieldCacheKeyStrict, r as recordIdentifierFor, z as withSignalStore } from "./request-state-55umD7hP.js";
2
+ export { I as checkout, J as commit } from "./request-state-55umD7hP.js";
3
3
  import { isResourceSchema } from './types/schema/fields.js';
4
4
  import { D as Destroy, C as Context } from "./symbols-sql1_mdx.js";
5
5
  export { a as Checkout } from "./symbols-sql1_mdx.js";
@@ -1072,6 +1072,27 @@ function getArrayField(context) {
1072
1072
  } = context;
1073
1073
  let managedArray = signal.value;
1074
1074
  if (managedArray) {
1075
+ // if the signal is stale, we need to check the rawValue has not become
1076
+ // `null`.
1077
+ if (signal.isStale) {
1078
+ const {
1079
+ store,
1080
+ resourceKey,
1081
+ path,
1082
+ field
1083
+ } = context;
1084
+ const {
1085
+ cache
1086
+ } = store;
1087
+ const rawValue = cache.getAttr(resourceKey, path);
1088
+ // if the rawValue is null or the rawValue is undefined and the field has no defaultValue
1089
+ // we need to reset the managedArray to null
1090
+ if (rawValue === null || !rawValue && typeof rawValue === 'undefined' && !field.options?.defaultValue) {
1091
+ signal.value = null;
1092
+ // TODO once we fix schema-object GC we should run Destroy here on the managed array
1093
+ return null;
1094
+ }
1095
+ }
1075
1096
  return managedArray;
1076
1097
  } else {
1077
1098
  const {
@@ -1087,7 +1108,7 @@ function getArrayField(context) {
1087
1108
 
1088
1109
  // we only apply the defaultValue if the rawValue is undefined, this allows
1089
1110
  // use of explicit null for the field.
1090
- if (!rawValue && typeof rawValue === 'undefined' && field.kind === 'schema-array' && field.options?.defaultValue) {
1111
+ if (!rawValue && typeof rawValue === 'undefined' && field.options?.defaultValue) {
1091
1112
  rawValue = [];
1092
1113
  }
1093
1114
  if (!rawValue) {
@@ -1,2 +1,2 @@
1
- export { C as CacheHandler, D as DISPOSE, R as RecordArrayManager, x as Signals, S as Store, g as StoreMap, _ as _clearCaches, n as _deprecatingNormalize, b as coerceId, c as constructResource, B as consumeInternalSignal, h as createLegacyManyArray, m as createRequestSubscription, v as defineGate, w as defineNonEnumerableSignal, u as defineSignal, e as ensureStringId, t as entangleSignal, f as fastPush, q as gate, E as getOrCreateInternalSignal, k as getPromiseState, o as getRequestState, a as isRequestKey, i as isResourceKey, l as log, j as logGroup, p as memoized, A as notifyInternalSignal, y as peekInternalSignal, r as recordIdentifierFor, d as setRecordIdentifier, s as storeFor, z as withSignalStore } from "../request-state-glkInb2R.js";
1
+ export { C as CacheHandler, D as DISPOSE, R as RecordArrayManager, x as Signals, S as Store, g as StoreMap, _ as _clearCaches, n as _deprecatingNormalize, b as coerceId, c as constructResource, B as consumeInternalSignal, h as createLegacyManyArray, m as createRequestSubscription, v as defineGate, w as defineNonEnumerableSignal, u as defineSignal, e as ensureStringId, t as entangleSignal, f as fastPush, q as gate, E as getOrCreateInternalSignal, k as getPromiseState, o as getRequestState, a as isRequestKey, i as isResourceKey, l as log, j as logGroup, p as memoized, A as notifyInternalSignal, y as peekInternalSignal, r as recordIdentifierFor, d as setRecordIdentifier, s as storeFor, z as withSignalStore } from "../request-state-55umD7hP.js";
2
2
  export { A as ARRAY_SIGNAL, O as OBJECT_SIGNAL, c as createMemo, w as waitFor } from "../configure-B48bFHOl.js";
@@ -1,6 +1,6 @@
1
1
  import { macroCondition, getGlobalConfig } from '@embroider/macros';
2
2
  const name = "@warp-drive/core";
3
- const version = "5.7.0-alpha.21";
3
+ const version = "5.7.0-alpha.22";
4
4
 
5
5
  // in testing mode, we utilize globals to ensure only one copy exists of
6
6
  // these maps, due to bugs in ember-auto-import
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warp-drive/core",
3
- "version": "5.7.0-alpha.21",
3
+ "version": "5.7.0-alpha.22",
4
4
  "description": "Core package for WarpDrive | All the Universal Basics",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -37,13 +37,13 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@embroider/macros": "^1.16.12",
40
- "@warp-drive/build-config": "5.7.0-alpha.21"
40
+ "@warp-drive/build-config": "5.7.0-alpha.22"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/core": "^7.26.10",
44
44
  "@babel/plugin-transform-typescript": "^7.27.0",
45
45
  "@babel/preset-typescript": "^7.27.0",
46
- "@warp-drive/internal-config": "5.7.0-alpha.21",
46
+ "@warp-drive/internal-config": "5.7.0-alpha.22",
47
47
  "decorator-transforms": "^2.3.0",
48
48
  "ember-source": "~6.3.0",
49
49
  "expect-type": "^1.2.1",