Skip to content

Commit 86ca32e

Browse files
fix(overmind): properly read mode
1 parent 9b0417e commit 86ca32e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

packages/node_modules/overmind/src/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ export class Overmind<ThisConfig extends IConfiguration>
243243
const proxyStateTree = this.createProxyStateTree(
244244
configuration,
245245
eventHub,
246-
mode.mode === MODE_TEST || process.env.NODE_ENV === devEnv
246+
mode.mode === MODE_TEST || process.env.NODE_ENV === devEnv,
247+
mode.mode === MODE_SSR
247248
)
248249
this.originalConfiguration = configuration
249250
this.state = proxyStateTree.state
@@ -395,13 +396,14 @@ export class Overmind<ThisConfig extends IConfiguration>
395396
private createProxyStateTree(
396397
configuration: IConfiguration,
397398
eventHub: EventEmitter<any> | MockedEventEmitter,
398-
devmode: boolean
399+
devmode: boolean,
400+
ssr: boolean
399401
) {
400402
const proxyStateTree = new ProxyStateTree(
401403
this.getState(configuration) as any,
402404
{
403405
devmode,
404-
ssr: this.mode.mode === MODE_SSR,
406+
ssr,
405407
delimiter: this.delimiter,
406408
onSetFunction: (tree, path, target, prop, func) => {
407409
if (func[IS_DERIVED_CONSTRUCTOR]) {

packages/node_modules/overmind/src/ssr.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('Mock', () => {
7878
const overmind = new Overmind(config)
7979

8080
expect(json(overmind.state)).toEqual({
81-
foo: 'bar2'
81+
foo: 'bar2',
8282
})
8383
})
8484
})

0 commit comments

Comments
 (0)