Skip to content

Remove providers and executors

Pre-release
Pre-release

Choose a tag to compare

@thetutlage thetutlage released this 05 Nov 05:31

Removing providers

Both the providers and the executors have been removed in the favor of object based hooks. Object based hooks can serve both the use cases.

The providers were tracked separately from the hooks and therefore their order of execution will always be at the last or the first. It can be mixed with hooks. For example:

hooks.add('saving', () => {
  console.log('first')
})

class SomeProvider {
  saving() {
    console.log('saving')
  }
}
hooks.provider(SomeProvider)

hooks.add('saving', () => {
  console.log('third')
})

The execution output will be

first
third
second

This can be problematic in some edge case scenarios and we want to guarantee the order of execution to be same as the order of defining hooks or providers. Therefore, the providers have been removed

Removing executors

Custom executors were meant to customize how a hook handler should be called. The same can be achieved using object based hooks and wrapping the original hook handler.

Commits

  • refactor: remove providers and executor in favor of object based hooks b756e70

v7.0.0-0...v7.1.0-0