MCPcopy Index your code
hub / github.com/ctrlplusb/react-async-component / resolveModule

Method resolveModule

src/asyncComponent.js:145–180  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

143 }
144
145 resolveModule() {
146 return getResolver()
147 .then(module => {
148 if (state.asyncComponents != null) {
149 state.asyncComponents.resolved(state.id)
150 }
151 state.module = module
152 state.error = null
153 state.resolving = false
154 return module
155 })
156 .catch(({ message, stack }) => {
157 const error = { message, stack }
158 if (state.asyncComponents != null) {
159 state.asyncComponents.failed(state.id, error)
160 }
161 state.error = error
162 state.resolving = false
163 if (!ErrorComponent) {
164 // eslint-disable-next-line no-console
165 console.error(error)
166 }
167 })
168 .then(result => {
169 if (this.unmounted) {
170 return undefined
171 }
172 if (
173 !this.context.reactAsyncBootstrapperRunning &&
174 env === 'browser'
175 ) {
176 this.forceUpdate()
177 }
178 return result
179 })
180 }
181
182 componentWillUnmount() {
183 this.unmounted = true

Callers 2

doResolveMethod · 0.95
componentDidMountMethod · 0.95

Calls 1

getResolverFunction · 0.85

Tested by

no test coverage detected