AmazeeLabs / silverback-mono

Silverback Monorepo. Central hub for our open source packages and tooling.
https://silverback.netlify.app
8 stars 7 forks source link

refactor!: turn executors into react contexts #1509

Closed pmelab closed 5 months ago

pmelab commented 5 months ago

BREAKING CHANGE: executors are now based on context and have to be used that way

Package(s) involved

Description of changes

Use Reacts built-in context for registering and retrieving operation executors.

Motivation and context

The previous approach using a global variable turned out to be unstable due to reacts asynchronous architecture and frameworks using multiple processes. Turning it into a proper context should avoid those issues. The global variable was used to be compatible to react server components, but there is a different solution using conditional imports: https://github.com/reactjs/rfcs/blob/main/text/0227-server-module-conventions.md#react-server-conditional-exports

How has this been tested?

Unit tests