While moving from models to schemas we were running into this error:
Steps:
- Clone https://github.com/mkszepp/warp-drive-null-reactive-resource-error
pnpm i & pnpm start
- Go to
http://localhost:4200/ and click on Grand Old Mansion or go directly to http://localhost:4200/1
- Click on "delete" button
- Error will thrown
This issue is only present with schemas, with models this issue will not happen.
If you rename the folder _models to models and disable in store.js the schema imports you can test the behavior with models, which is correct.
Notes:
- The issue will gone way, when you disable the
<p>{{this.model.owner.name}}</p> in detail.gts.
- In our app we have a similar error with
hasMany, maybe its related. (TypeError: can't access property "length", source is undefined`)

Error is in this line:
|
const newLength = source.length; |
The fastPush was called from this function
|
_syncArray(array: ManyArray): void { |
|
const method = this.editable ? 'getRelationship' : 'getRemoteRelationship'; |
|
// FIXME field needs to use sourceKey |
|
const rawValue = this.store.cache[method](this.identifier, array.key) as CollectionRelationship; |
|
|
|
if (rawValue.meta) { |
|
array.meta = rawValue.meta; |
|
} |
|
|
|
if (rawValue.links) { |
|
array.links = rawValue.links; |
|
} |
|
|
|
const currentState = array[Context].source; |
|
|
|
// unlike in the normal RecordArray case, we don't need to divorce the reference |
|
// because we don't need to worry about associate/disassociate since the graph |
|
// takes care of that for us |
|
if (currentState !== rawValue.data) { |
|
currentState.length = 0; |
|
fastPush(currentState, rawValue.data as ResourceKey[]); |
|
} |
|
} |
While moving from models to schemas we were running into this error:
Steps:
pnpm i&pnpm starthttp://localhost:4200/and click onGrand Old Mansionor go directly tohttp://localhost:4200/1This issue is only present with schemas, with models this issue will not happen.
If you rename the folder
_modelstomodelsand disable instore.jsthe schema imports you can test the behavior withmodels, which is correct.Notes:
<p>{{this.model.owner.name}}</p>indetail.gts.hasMany, maybe its related. (TypeError: can't access property "length", source is undefined`)Error is in this line:
warp-drive/scripts/benchmark-push.js
Line 12 in ec6ee6a
The fastPush was called from this function
warp-drive/warp-drive-packages/core/src/reactive/-private/fields/many-array-manager.ts
Lines 34 to 56 in ec6ee6a