Skip to content

Commit

Permalink
refactor: use config object customInjector
Browse files Browse the repository at this point in the history
  • Loading branch information
rainerhahnekamp committed Sep 24, 2024
1 parent fb0cfed commit db893a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/signals/rxjs-interop/spec/rx-method.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ describe('rxMethod', () => {
injector = inject(Injector);

ngOnInit() {
this.store.log(this.store.globalSignal, this.injector);
this.store.log(this.store.globalSignal, { injector: this.injector });
}
}

Expand Down
4 changes: 3 additions & 1 deletion modules/signals/rxjs-interop/src/rx-method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
effect,
inject,
Injector,
input,
isSignal,
Signal,
untracked,
Expand Down Expand Up @@ -33,10 +34,11 @@ export function rxMethod<Input>(

const rxMethodFn = (
input: Input | Signal<Input> | Observable<Input>,
customInjector?: Injector
config?: { injector?: Injector }
) => {
if (isSignal(input)) {
const callerInjector = getCallerInjectorIfAvailable();
const customInjector = config?.injector;
const instanceInjector = customInjector ?? callerInjector ?? injector;

const watcher = effect(
Expand Down

0 comments on commit db893a0

Please sign in to comment.