app-unloaded: Micro app unloaded
Cause
The micro app was disposed of with unload(), unloadMicroApp(), or unloadApplication(), or by qiankun after its bootstrap failed (the error's cause is then that bootstrap error), but code still uses the disposed instance:
- It calls
mount(),unmount(), orupdate()on an invalidated handle. - A
mountPromisethat was still pending during disposal is rejected. - An unfinished loading request of the instance is canceled.
Troubleshooting
- Use the stack trace to find code that still uses the invalidated handle, such as a callback or timer that fires after a component unmounts.
- Check the order of
unload()relative tomount()andupdate()calls, and look for concurrent operations. - If the error surfaces where
mountPromiseis awaited, check whether the cancellation is expected.
Solution
unload() is terminal cleanup. Unlike unmount(), it does not allow the instance to be mounted again. Call unmount() to hide an app temporarily. To run an app again after disposal, call loadMicroApp to create a new instance.
Handle rejections caused by expected cancellation and stop subsequent work.
