Handling async route rendering at the client
autarc opened this issue · 2 comments
The example shown for the client doesn't regard the asynchronous behavior of fetching data and updating the view. Since the emitter/trigger don't hook into the underlying lifecycle of the component, the initial rendering will be executed and finished before the provideHook
promises are resolved. At the server side this can be controlled through a wrapped response, while at the client it seems to be more difficult. In case of React Router for instance its probably necessary to define the onEnter transitions and invoke their callbacks as the result of a successful promise chain. Any thoughts for a general implementation ?
@svrcekmichal Thanks, you actually pointed me in the right direction: using history.listenBefore
instead of history.listen
was a drop-in-replacement and solves the issue 👍
Submitted an improved example.