-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(store): tree-shake internal state tokens
In this commit, we remove internal injection token providers from the root providers list. Instead, we expose a function that provides these tokens.
- Loading branch information
Showing
5 changed files
with
27 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { makeEnvironmentProviders } from '@angular/core'; | ||
import { ɵNGXS_STATE_CONTEXT_FACTORY, ɵNGXS_STATE_FACTORY } from '@ngxs/store/internals'; | ||
|
||
import { StateFactory } from './state-factory'; | ||
import { StateContextFactory } from './state-context-factory'; | ||
|
||
// Backward compatibility is provided because these tokens are used by third-party | ||
// libraries. We expose a separate function to allow tree-shaking of these tokens | ||
// if they are not used in standard applications that do not rely on them. | ||
export function ɵprovideNgxsInternalStateTokens() { | ||
return makeEnvironmentProviders([ | ||
{ | ||
provide: ɵNGXS_STATE_CONTEXT_FACTORY, | ||
useExisting: StateContextFactory | ||
}, | ||
{ | ||
provide: ɵNGXS_STATE_FACTORY, | ||
useExisting: StateFactory | ||
} | ||
]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters