-
Notifications
You must be signed in to change notification settings - Fork 596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Experiment Async Route support #653
base: master
Are you sure you want to change the base?
Conversation
|
||
Choo.prototype._initAsyncProxy = function () { | ||
var tagName = this._tree ? this._tree.nodeName : 'body' | ||
this._asyncProxy = document.createElement(tagName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid this won't work on the server
renderRoute = state.route | ||
loadingState = LOADING | ||
|
||
var p = loader(onload) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need to pass in the onload
callback here if p
must return a promise anyway
I love this idea! Before I knew about choo-lazy-route I started work on pretty much the exact same thing called choo-lazy-view but it has support for a third argument being a loader view. Not only was the loader view a nice way of giving immediate feedback but also offers an opportunity for prefetching content needed by the view being loaded. Ofc, this could just as well be done by listening for the |
@tornqvist it'd be awesome if someone could take this PR over the finish line. I ran out of time to work on it in over summer, but would love if this could eventually land! |
I've been working a bit on this lately but have hit a wall regarding what to do with SSR. On the client side we either preserve the current view as the async route is being loaded or the user could supply a loader function that would be rendered in its place. On the server side it's a bit more tricky. Both choo-lazy-route and choo-lazy-view use As I see it we either standardize Any opinions on this matter? I personally would prefer the latter and let |
Porting https://github.com/goto-bus-stop/choo-lazy-route to be a first-class citizen in Choo. Should allow loading routes async directly.
Right now the API is prefixed with experimental, as it probably requires some discussion on how to stabilize. But feel it's worthwhile adding a non-hacky way to allow this in the meantime. If anything so we can iterate on the functionality while keeping clear that this isn't ready for prime time yet.
Thanks!