-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Swap timing #8
Comments
I like the sound of this. @bryanrsmith Please read above and lets start a discussion about this. I'd like to know what you think. |
I think if we ever added this, we would need to make it configurable because certain animations will require this to be handled differently. |
Closing this since we aren't changing the internal pipeline at this point. There is a new swap order property on the router-view which allows controlling animation timing. |
Can you provide details about the swap order property? Does it support the scenario described in this issue? |
@jods4 Swap order simply allows you specify the order the next view and last view get created and removed. for example, specifying Something that may be of interest to you, is a new method I added to the ViewSlot. This method takes a view, and a direction, whether Something you could do is, replace it with a method that re-calls the original |
@joelcoxokc I had a look. This allows all kinds of transitions (e.g. cross-fade, one after the other, etc.). It's nice. But it doesn't allow what I wanted here, which is being able to animate out the current view before @EisenbergEffect Even if it's not supported by Aurelia proper, it would be possible to do this as an outside extension if you would just add a pipeline hook between
So I think I can do what I wanted, if you would just add a pipeline step between |
See here: https://github.com/aurelia/router/blob/master/src/pipeline-provider.js#L36 (Note that you can always create your own pipeline provider, register it with the DI and then have full control.) |
Right, I forgot that. So yes, I could hack this without a single change to Aurelia. Let me know what you think: do you want to add a new pipeline step or rather not? |
Send a PR with what you have in mind and let us look at it. It's fine with me, based on your description. |
Sorry, forgot to ask the tricky question: what name would be a good name? |
I'll let you figure that out 😆 |
I see. @jods4 I just implemented something similar for the next hub release... to allow the side panel to animate before the view loads. A PR would be great, that we can make it standard |
@EisenbergEffect @joelcoxokc |
Cool. |
I think the way the swap is done in
<router-view>
is not ideal for perceived speed and loaders / animation purposes.The main steps of nav. lifecycle are (in order):
canDeactivate()
, which can vetocanActivate()
, which can vetodeactivate()
, no turning back from hereactivate()
.activate()
is a great place to load data for the next screen. It ensures that all required data is there before the screen is actually bound (better for perf, no flickering on screen, etc.).Because it is allowed to return a Promise, this is well handled by the Router, which will wait before displaying the new screen. Moreover you can use
isNavigating
to display a loader indicator on screen.What doesn't fit nicely in my opinion is the way the views are swapped. Basically, all steps 1 to 4 are first done and then the old view is removed and the new view put in place as one operation. This makes a slightly clumsy experience where you must put some kind of modal blocker on top of the old screen (or fake "remove" it yourself) while waiting for
activate()
to resolve (e.g. for data to be loaded from the web server).I think it would be a better experience if it went like this:
canDeactivate()
, which can vetocanActivate()
, which can vetodeactivate()
, no turning back from hereactivate()
.This way, the old UI naturally goes away, you can display a "loading" indicator easily and the new view appears when it's ready. Better.
Moreover there's an important benefit in terms of perceived speed. If you use an animation to remove your old view at step 4, it will hide (some of) the latency of your loading at step 5 (provided you don't wait for animation completion before step 6, so that 4 & 5 happen in parallel).
This is an important issue because there is no good way to coordinate all this without proper Aurelia support.
The text was updated successfully, but these errors were encountered: