Skip to content

Commit

Permalink
fix(AP-1778): confirm only on browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Strom authored and mattstrom committed Sep 12, 2022
1 parent fd00da2 commit 9e8b523
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "npm-run-all --parallel start:*",
"start:next": "lerna run dev --scope=@evolv/nextjs-demo",
"start:react": "lerna run start --scope=@evolv/react-demo",
"start:watch": "lerna run watch --scope @evolv/nextjs --scope @evolv/react",
"start:watch": "lerna run --parallel --stream watch --scope @evolv/nextjs --scope @evolv/react",
"clean": "lerna run clean",
"test": "lerna run test"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"scripts": {
"clean": "del dist **/*.tsbuildinfo",
"prebuild": "npm run clean",
"build": "tsc --build tsconfig.json"
"build": "tsc --build tsconfig.json",
"watch": "tsc --build tsconfig.json --watch"
},
"files": [
"dist"
Expand Down
8 changes: 6 additions & 2 deletions packages/nextjs/src/client.adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ export class ClientAdapter {
return this._evolvState;
}

get isBrowser() {
return typeof window !== 'undefined';
}

get isServer() {
return typeof window === 'undefined';
return !this.isBrowser;
}

public subscribers: Record<string, Function[]> = {};
Expand All @@ -27,7 +31,7 @@ export class ClientAdapter {
this._evolvState = hydratedState ?? {};

this._client = new EvolvClient({
autoConfirm: true,
autoConfirm: this.isBrowser,
analytics: true,
clientName: 'react-sdk',
...options
Expand Down

0 comments on commit 9e8b523

Please sign in to comment.