Skip to content

Commit 8e47105

Browse files
author
liuxinyi12
committed
fix: 合并master对didMount执行顺序bug的修复
2 parents 1395ef2 + 9e5d1a5 commit 8e47105

File tree

7 files changed

+43
-5
lines changed

7 files changed

+43
-5
lines changed

packages/nerv-create-class/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
<a name="1.3.13"></a>
7+
## [1.3.13](https://github.com/NervJS/nerv/compare/v1.3.12...v1.3.13) (2019-03-21)
8+
9+
10+
11+
12+
**Note:** Version bump only for package nerv-create-class
13+
614
<a name="1.3.12"></a>
715
## [1.3.12](https://github.com/NervJS/nerv/compare/v1.3.11...v1.3.12) (2019-01-30)
816

packages/nerv-devtools/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
<a name="1.3.13"></a>
7+
## [1.3.13](https://github.com/NervJS/nerv/compare/v1.3.12...v1.3.13) (2019-03-21)
8+
9+
10+
11+
12+
**Note:** Version bump only for package nerv-devtools
13+
614
<a name="1.3.12"></a>
715
## [1.3.12](https://github.com/NervJS/nerv/compare/v1.3.11...v1.3.12) (2019-01-30)
816

packages/nerv-redux/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
<a name="1.3.13"></a>
7+
## [1.3.13](https://github.com/NervJS/nerv/compare/v1.3.12...v1.3.13) (2019-03-21)
8+
9+
10+
11+
12+
**Note:** Version bump only for package nerv-redux
13+
614
<a name="1.3.12"></a>
715
## [1.3.12](https://github.com/NervJS/nerv/compare/v1.3.11...v1.3.12) (2019-01-30)
816

packages/nerv-redux/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"redux": "^3.7.2"
1919
},
2020
"peerDependencies": {
21-
"nervjs": "1.3.12",
21+
"nervjs": "1.3.13",
2222
"redux": ">=2"
2323
}
2424
}

packages/nerv/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
<a name="1.3.13"></a>
7+
## [1.3.13](https://github.com/NervJS/nerv/compare/v1.3.12...v1.3.13) (2019-03-21)
8+
9+
10+
### Bug Fixes
11+
12+
* call this.setState fail in the callback of componentWillMount's this.setState ([0e38891](https://github.com/NervJS/nerv/commit/0e38891))
13+
14+
15+
16+
617
<a name="1.3.12"></a>
718
## [1.3.12](https://github.com/NervJS/nerv/compare/v1.3.11...v1.3.12) (2019-01-30)
819

packages/nerv/__tests__/lifecycle.spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ describe('Lifecycle methods', () => {
192192
expect(cwrp.called).toBeTruthy()
193193
expect(cdu.called).toBeFalsy()
194194
}
195+
componentDidMount () {
196+
expect(cdm.called).toBeFalsy()
197+
}
195198
render () {
196199
return <div />
197200
}

packages/nerv/src/lifecycle.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,11 @@ export function mountComponent (
111111
}
112112
}, component)
113113
component.state = component.getState()
114-
component.clearCallBacks()
115114
}
116115
component._dirty = false
117116
const rendered = renderComponent(component)
118117
rendered.parentVNode = vnode
119118
component._rendered = rendered
120-
if (isFunction(component.componentDidMount)) {
121-
readyComponents.push(component)
122-
}
123119
if (!isNullOrUndef(ref)) {
124120
Ref.attach(vnode, ref, vnode.dom as Element)
125121
}
@@ -129,7 +125,11 @@ export function mountComponent (
129125
component
130126
) as Element)
131127
invokeEffects(component)
128+
if (isFunction(component.componentDidMount)) {
129+
readyComponents.push(component)
130+
}
132131
component._disable = false
132+
component.clearCallBacks()
133133
return dom
134134
}
135135

0 commit comments

Comments
 (0)