Skip to content

Commit

Permalink
fix(devtools): ssr mode
Browse files Browse the repository at this point in the history
  • Loading branch information
rainerhahnekamp committed Dec 18, 2023
1 parent aee6def commit 0fa5e67
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions libs/ngrx-toolkit/src/lib/with-devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@ import {
SignalStoreFeature,
} from '@ngrx/signals';
import { SignalStoreFeatureResult } from '@ngrx/signals/src/signal-store-models';
import {
effect,
EffectRef,
inject,
PLATFORM_ID,
signal,
Signal,
} from '@angular/core';
import { effect, inject, PLATFORM_ID, signal, Signal } from '@angular/core';
import { isPlatformServer } from '@angular/common';

declare global {
Expand Down Expand Up @@ -92,8 +85,12 @@ export function withDevtools<Input extends SignalStoreFeatureResult>(
): SignalStoreFeature<Input, EmptyFeatureResult> {
return (store) => {
const isServer = isPlatformServer(inject(PLATFORM_ID));
if (isServer) {
return store;
}

const extensions = window.__REDUX_DEVTOOLS_EXTENSION__;
if (isServer || !extensions) {
if (!extensions) {
return store;
}

Expand Down

0 comments on commit 0fa5e67

Please sign in to comment.