Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Commit

Permalink
Rename InitialStateToken to GetInitialStateToken (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
ganemone authored Feb 8, 2018
1 parent 0d3753b commit a017641
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ yarn add fusion-plugin-react-redux
```js
// in your main.js file
import React from 'react';
import Redux, {ReduxToken, ReducerToken, EnhancerToken, InitialStateToken} from 'fusion-plugin-react-redux';
import Redux, {ReduxToken, ReducerToken, EnhancerToken, GetInitialStateToken} from 'fusion-plugin-react-redux';
import ReduxActionEmitterEnhancer from 'fusion-plugin-redux-action-emitter-enhancer';
import App from 'fusion-react';
import reducer from './reducer';
Expand All @@ -31,7 +31,7 @@ export default function start() {
app.register(ReduxToken, Redux);
app.register(ReducerToken, reducer);
app.register(EnhancerToken, ReduxActionEmitterEnhancer);
__NODE__ && app.register(InitialStateToken, async (ctx) => {
__NODE__ && app.register(GetInitialStateToken, async (ctx) => {
return {};
});

Expand All @@ -55,13 +55,13 @@ import {
ReducerToken,
PreloadedStateToken,
EnhancerToken,
InitialStateToken
GetInitialStateToken
} from 'fusion-plugin-react-redux';

app.register(ReducerToken, reducer);
app.register(PreloadedStateToken, preloadedState);
app.register(EnhancerToken, enhancer);
__NODE__ && app.register(InitialStateToken, getInitialState);
__NODE__ && app.register(GetInitialStateToken, getInitialState);
```

Creates the redux store and integrates it into the FusionJS application.
Expand All @@ -78,7 +78,7 @@ Name | Type | Default | Description
-|-|-|-
`PreloadedStateToken` | `any` | `undefined` | Overrides the initial state in the server, and the hydrated state in the client
`EnhancerToken` | `FusionPlugin` | `undefined` | Enhances the store with 3rd party capabilities, such as middlewares, time travel, persistence, etc. We are currently investigating enhancer composition in fusionjs/fusion-core#90, but for now you can use plugin aliasing for registering multiple enhancers: `app.register(EnhancerToken, ReduxActionEmitterEnhancer).alias(EnhancerToken, AnotherEnhancerPlugin);`.
`InitialStateToken` | `(ctx) => Promise<any>` | `undefined` | A function that returns the initial state for your redux store. Server-side only.
`GetInitialStateToken` | `(ctx) => Promise<any>` | `undefined` | A function that returns the initial state for your redux store. Server-side only.

#### Factory

Expand Down
6 changes: 6 additions & 0 deletions docs/migrations/00069.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#### Rename `InitialStateToken` to `GetInitialStateToken`

```diff
-import {InitialStateToken} from 'fusion-plugin-react-redux';
+import {GetInitialStateToken} from 'fusion-plugin-react-redux';
```
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ export {
ReducerToken,
PreloadedStateToken,
EnhancerToken,
InitialStateToken,
GetInitialStateToken,
} from './tokens';
4 changes: 2 additions & 2 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
ReducerToken,
PreloadedStateToken,
EnhancerToken,
InitialStateToken,
GetInitialStateToken,
} from './tokens.js';

export default __NODE__ &&
Expand All @@ -22,7 +22,7 @@ export default __NODE__ &&
reducer: ReducerToken,
preloadedState: PreloadedStateToken.optional,
enhancer: EnhancerToken.optional,
getInitialState: InitialStateToken.optional,
getInitialState: GetInitialStateToken.optional,
},
provides({reducer, preloadedState, enhancer, getInitialState}) {
class Redux {
Expand Down
2 changes: 1 addition & 1 deletion src/tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export const ReduxToken = createToken('ReduxToken');
export const ReducerToken = createToken('ReducerToken');
export const PreloadedStateToken = createToken('PreloadedStateToken');
export const EnhancerToken = createToken('EnhancerToken');
export const InitialStateToken = createToken('InitialStateToken');
export const GetInitialStateToken = createToken('GetInitialStateToken');

0 comments on commit a017641

Please sign in to comment.