Skip to content

Error: null is not a ReactiveResource or Model known to WarpDrive with schemas (legacy) #10530

Description

@mkszepp

While moving from models to schemas we were running into this error:

Image

Steps:

  1. Clone https://github.com/mkszepp/warp-drive-null-reactive-resource-error
  2. pnpm i & pnpm start
  3. Go to http://localhost:4200/ and click on Grand Old Mansion or go directly to http://localhost:4200/1
  4. Click on "delete" button
  5. 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`)
    Image
    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[]);
    }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions