Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hooks not working on mappers #573

Open
IAmJulianAcosta opened this issue Sep 5, 2020 · 0 comments
Open

Hooks not working on mappers #573

IAmJulianAcosta opened this issue Sep 5, 2020 · 0 comments

Comments

@IAmJulianAcosta
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant