Skip to content

Commit 8700e54

Browse files
author
hk
committed
fix: safari does not paint the fallback component
1 parent 85074eb commit 8700e54

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/component/src/createLoadable.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ function createLoadable({ resolve = identity, render, onLoad }) {
8989
this.mounted = true
9090

9191
if (this.state.loading) {
92-
this.loadAsync()
92+
setTimeout(() => {
93+
this.loadAsync()
94+
})
9395
} else if (!this.state.error) {
9496
this.triggerOnLoad()
9597
}
@@ -183,7 +185,15 @@ function createLoadable({ resolve = identity, render, onLoad }) {
183185

184186
if (options.suspense) {
185187
const cachedResult = this.getCache()
186-
if (!cachedResult) throw this.loadAsync()
188+
if (!cachedResult) throw new Promise(resolve => {
189+
setTimeout(() => {
190+
setTimeout(() => {
191+
this.loadAsync().then(res => {
192+
resolve(res)
193+
})
194+
})
195+
})
196+
})
187197
return render({
188198
loading: false,
189199
fallback: null,

0 commit comments

Comments
 (0)