mirror of
https://github.com/gregberge/loadable-components.git
synced 2026-01-25 15:24:15 +00:00
cache promise on load/preload (#830)
This commit is contained in:
parent
9ff66939ee
commit
33cb54dfbb
@ -343,10 +343,13 @@ function createLoadable({
|
||||
|
||||
// In future, preload could use `<link rel="preload">`
|
||||
Loadable.preload = props => {
|
||||
ctor.requireAsync(props)
|
||||
cache[getCacheKey()] = ctor.requireAsync(props);
|
||||
}
|
||||
|
||||
Loadable.load = props => ctor.requireAsync(props)
|
||||
Loadable.load = props => {
|
||||
cache[getCacheKey()] = ctor.requireAsync(props);
|
||||
return cache[getCacheKey()];
|
||||
}
|
||||
|
||||
return Loadable
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user