mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Simplify logic for extensionInjectable
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
c74f88fda6
commit
65045fb0ba
@ -28,20 +28,21 @@ const extensionInjectable = getInjectable({
|
||||
|
||||
return {
|
||||
register: () => {
|
||||
extensionRegistrators.forEach((getInjectablesOfExtension) => {
|
||||
const injectables = getInjectablesOfExtension(instance);
|
||||
for (const extensionRegistrator of extensionRegistrators) {
|
||||
const injectables = extensionRegistrator(instance);
|
||||
|
||||
reactionDisposer.push(
|
||||
// injectables is either an array or a computed array, in which case
|
||||
// we need to update the registered injectables with a reaction every time they change
|
||||
reaction(
|
||||
() => Array.isArray(injectables) ? injectables : injectables.get(),
|
||||
if (Array.isArray(injectables)) {
|
||||
injectableDifferencingRegistrator(injectables);
|
||||
} else {
|
||||
reactionDisposer.push(reaction(
|
||||
() => injectables.get(),
|
||||
injectableDifferencingRegistrator,
|
||||
{
|
||||
fireImmediately: true,
|
||||
},
|
||||
));
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
deregister: () => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user