Skip to content

Commit

Permalink
Resolve import cycle to improve tool compatibility
Browse files Browse the repository at this point in the history
This change resolves the cyclical import dependency
`store-devtools/src/{provide-store-devtools <-> instrument}.ts` by
moving `createStateObservable` to `provide-store-devtools.ts`, its only
user.
  • Loading branch information
raphinesse committed Jan 10, 2025
1 parent cf62e71 commit f644ca9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 0 additions & 8 deletions modules/store-devtools/src/instrument.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import { ModuleWithProviders, NgModule } from '@angular/core';
import { StateObservable } from '@ngrx/store';
import { StoreDevtoolsOptions } from './config';
import { StoreDevtools } from './devtools';
import { provideStoreDevtools } from './provide-store-devtools';

export function createStateObservable(
devtools: StoreDevtools
): StateObservable {
return devtools.state;
}

@NgModule({})
export class StoreDevtoolsModule {
static instrument(
Expand Down
7 changes: 6 additions & 1 deletion modules/store-devtools/src/provide-store-devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
StoreDevtoolsOptions,
} from './config';
import { ReducerManagerDispatcher, StateObservable } from '@ngrx/store';
import { createStateObservable } from './instrument';
import { StoreDevtools } from './devtools';

export const IS_EXTENSION_OR_MONITOR_PRESENT = new InjectionToken<boolean>(
Expand All @@ -46,6 +45,12 @@ export function createReduxDevtoolsExtension() {
}
}

export function createStateObservable(
devtools: StoreDevtools
): StateObservable {
return devtools.state;
}

/**
* Provides developer tools and instrumentation for `Store`.
*
Expand Down

0 comments on commit f644ca9

Please sign in to comment.