Skip to content

Commit afa7279

Browse files
committed
feat(server): passed the server instance to the store configurator
this allows it to be provided downstream for SSR logic triggered by redux middleware to have access to the server instance for internal routing and other needs
1 parent 98d0ce5 commit afa7279

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/route.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function register(server, options, next) {
99
routes: options.routes,
1010
respond: options.respond,
1111
Root: options.Root,
12-
store: options.configureStore({session: {auth: request.auth.credentials}})
12+
store: options.configureStore({session: {auth: request.auth.credentials}, server})
1313
})
1414
});
1515

test/unit/route-test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ suite('route', () => {
2929
const auth = {credentials: any.simpleObject()};
3030
const request = {...any.simpleObject(), auth};
3131
const reply = any.simpleObject();
32+
const server = {route};
3233
const Root = any.simpleObject();
3334
const store = any.simpleObject();
3435
const configureStore = sinon.stub();
35-
configureStore.withArgs({session: {auth: auth.credentials}}).returns(store);
36+
configureStore.withArgs({session: {auth: auth.credentials}, server}).returns(store);
3637

37-
register({route}, {respond, routes, Root, configureStore}, next);
38+
register(server, {respond, routes, Root, configureStore}, next);
3839

3940
assert.calledOnce(next);
4041
assert.calledWith(route, sinon.match({

0 commit comments

Comments
 (0)