Skip to content

Commit

Permalink
chore: add review suggestion
Browse files Browse the repository at this point in the history
Co-authored-by: Artur <[email protected]>
  • Loading branch information
markwhitfeld and arturovt authored Aug 21, 2024
1 parent d3b8e50 commit c4e7ce5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/store/src/selectors/selector-checks.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ export function ensureValidSelector(
// If we have used this utility within a state class, we may be
// before the @State or @Selector decorators have been applied.
// wait until the next microtask to verify.
Promise.resolve().then(() => {
const isNgZoneEnabled = typeof Zone !== 'undefined';
const runOutsideAngular = isNgZoneEnabled ? (fn) => Zone.root.run(fn) : fn => fn();

runOutsideAngular(() => {
Promise.resolve().then(() => {
const errorAgain = getMissingMetaDataError(selector, { noun, prefix });
if (errorAgain) {
// Throw the originally captured error so that the stack trace shows the
Expand Down

0 comments on commit c4e7ce5

Please sign in to comment.