Skip to content

Hooks not working on mappers #573

@IAmJulianAcosta

Description

@IAmJulianAcosta

Description

I'm trying to add some hooks to a mapper this way:

store.defineMapper('event', {
  endpoint: 'events',
  schema: eventSchema,
  relations: eventRelations,
  beforeFindAll: function (id, opts) {
    Mapper.prototype.beforeFindAll.call(this, id, opts, result);
    hooks.push('user beforeFindAll');
  }
});

But the hook is never being called.

I suspect that the problem is: When this [fillIn()](https://github.com/js-data/js-data/blob/v4.0.0-beta.3/src/Mapper.ts#L442) is called, all hooks already have a value, so fillIn won't override the value because it already exists.

Environment

  • js-data version: 4.0.0-beta4
  • node or browser version: Opera 70
  • operating system: OSx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions