__hooks become writable and configurable#1520
Conversation
We should be able to modify or delete this value. In a particular case it will avoid me this kind of error: ``` Uncaught TypeError: Cannot redefine property: __hooks ``` ``` Uncaught TypeError: Cannot delete property '__hooks' of #<Object> ```
|
What would be the use case for this? It's usually not ideal having to modify undocumented framework internals in an application. For skipping hooks we can now e.g. use the adapter hook-less service methods. |
|
I wish I could edit or delete hooks, in my case I use uberproto to mixin a service in a const. This is not a normal use of Feathers but why protect these values? const Users = require('../services/users');
const service = Object.create(Users.prototype);
module.exports = service; // like a singleton ¯\_(ツ)_/¯
module.exports.init = () => {
const service = feathers()
.use( '/', new Users({ /* options */ }) )
.setup()
.service('/')
.hooks(hooks);
Proto.mixin(svc, service);
};This is not a choice but an imposed technical constraint. However, I do not have these errors anymore. |
|
This property just needs not to be enumerable. |
|
It's actually in a test suite that it stuck, because of the init called several times. These are internal values but if we want to modify or delete them in cases of advanced or atypical use we should be able to do it. #1520 (comment) |
We should be able to modify or delete this value.
In a particular case it will avoid me this kind of error: