Skip to content

Commit e0a5b74

Browse files
committed
fixed server and client router
1 parent 37c1134 commit e0a5b74

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "reshow",
3-
"version": "0.13.0-beta.20",
3+
"version": "0.13.0-beta.21",
44
"description": "Flux Reducer Present Library",
55
"main": "./build/cjs/src/index.js",
66
"module": "./build/es/src/index.js",
@@ -61,7 +61,8 @@
6161
"build:es:src": "BABEL_ENV=es babel src -d build/es/src --root-mode upward",
6262
"build:es:ui": "BABEL_ENV=es babel ui -d build/es/ui --root-mode upward",
6363
"build": "npm run clean && npm run build:cjs && npm run build:es",
64-
"mocha": "mocha -r jsdom-global/register 'build/cjs/**/__tests__/*.js'",
64+
"mochaFor": "mocha -r jsdom-global/register",
65+
"mocha": "npm run mochaFor -- 'build/cjs/**/__tests__/*.js'",
6566
"test": "npm run build && npm run mocha",
6667
"format": "prettier-eslint --write '**/src/**/*.js' '**/ui/**/*.jsx'",
6768
"prepublishOnly": "npm run test"

src/stores/globalStore.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1+
/**
2+
* Global Store use in calculateState
3+
* when themePath and global path not sync will rollback to use prev state.
4+
*
5+
* https://github.com/react-atomic/reshow/blob/master/packages/reshow-return/src/returnOptions.js#L55-L63
6+
*/
7+
18
export const globalStore = {};

ui/molecules/Reshow.jsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,26 @@ class Reshow extends PureComponent {
5050
}
5151

5252
getPath() {
53-
return this.resetGlobalPath();
53+
const {themePath, defaultThemePath} = this.props;
54+
return this.resetGlobalPath() || themePath || defaultThemePath;
5455
}
5556

57+
/**
58+
* @see globalStore https://github.com/react-atomic/reshow/blob/master/src/stores/globalStore.js
59+
*/
5660
resetGlobalPath(path) {
5761
if (path) {
5862
setTimeout(() => dispatch({ themePath: path }));
5963
} else {
60-
path = pageStore.getThemePath() || this.props.themePath;
64+
path = pageStore.getThemePath();
6165
}
6266
globalStore.path = path;
6367
return globalStore.path;
6468
}
6569

70+
/**
71+
* @see globalStore https://github.com/react-atomic/reshow/blob/master/src/stores/globalStore.js
72+
*/
6673
getGlobalPath() {
6774
return globalStore.path;
6875
}

ui/organisms/__tests__/SectionTest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe('Test Section', () => {
116116
setTimeout(() => {
117117
expect(wrap.el.getAttribute('name')).to.equal('test');
118118
done();
119-
});
119+
}, 10);
120120
});
121121

122122
it('not pass name if child already have name', done => {
@@ -173,6 +173,6 @@ describe('Test Section', () => {
173173
expect(uObj.el1.getAttribute('name')).to.be.null;
174174
expect(uObj.el2.getAttribute('name')).to.equal('test2');
175175
done();
176-
});
176+
}, 10);
177177
});
178178
});

0 commit comments

Comments
 (0)