Skip to content

Commit 5cf7230

Browse files
committed
fix($callbacks): adjust minor things
1 parent d536959 commit 5cf7230

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/flowTypes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ type OnAfter = (Info, any) => void
9797
export type Props = {
9898
error?: ?any,
9999
isLoading?: ?boolean,
100-
OnBefore?: OnBefore,
101-
OnAfter?: OnAfter
100+
onBefore?: OnBefore,
101+
onAfter?: OnAfter
102102
}
103103

104104
export type GenericComponent<Props> =

src/index.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,14 @@ export default function universal<Props: Props>(
170170
) {
171171
const { Component, error } = state
172172

173-
if (Component && state.error) {
173+
if (Component && !error) {
174174
hoist(UniversalComponent, Component, { preload: true })
175-
}
176175

177-
if (Component && !error && typeof this.props.onAfter === 'function') {
178-
const onAfter = this.props.onAfter
179-
const info = { isMount, isSync, isServer }
180-
this.setState(state, () => onAfter(info, Component))
181-
return
176+
if (this.props.onAfter === 'function') {
177+
const { onAfter } = this.props
178+
const info = { isMount, isSync, isServer }
179+
onAfter(info, Component)
180+
}
182181
}
183182

184183
this.setState(state)

0 commit comments

Comments
 (0)