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
Navigation lifecycle events #23
Milestone
Comments
vlukashov
pushed a commit
that referenced
this issue
Jun 6, 2018
…on. (#138) preparations for #23 --- * Fix recursive redirects. * Put a path that caused the function to be triggered into context and fill it correctly. * Revert cyclic redirects fix. * Code review fixes. * Update docs. * Rename invocationPath to invocationRoute * Merge branch 'master' into kb/fix-context-from-value * Instead of publishing an extra property to context, populate callback's `this` with the route that the function was defined in.
vlukashov
pushed a commit
that referenced
this issue
Jun 8, 2018
preparations for #23 --- * add a `chain` property to the resolver result The chain property contains the path of the route that has returned the result in the routes tree (an array of routes from the root of the routes tree to a leaf). If the result is returned by an action which obtained it by calling `next()` the returned chain contains only the path to that action's route. * Activate all routes. * Allow processing routes with empty paths. * Fix merge leftowers. * reivew fixes - explicitly skip the synthetic root route instead of all '' routes - compare routes for reference equality instead of comparing route paths - always initialize context.__resolutionChain * Rework inactivate approach. * Update action tests. * Fix promise handling, add test. * optimized the construction of `context.chain` Construct the chain once after resolve is done by walking up the routes tree from the resolved route to the root, instead of updating the chain all the time during the routes tree traversal. * address review comments * Remove unused property.
vlukashov
pushed a commit
that referenced
this issue
Jun 11, 2018
Vaadin.Router will call the following callbacks on the view Web Component (if defined): - `onBeforeEnter` - before attaching a view Web Component to the DOM - `onBeforeLeave` - before detaching a view Web Component from the DOM - `onAfterEnter` - after attaching a view Web Component to the DOM (after the connected callback is called) Fixes #23 --- * Support `onBeforeEnter` and `onBeforeLeave` navigation lifecycle events. * Make `onBefore...` callbacks have their element as `this` * New implementation. * add basic tests for lifecycle events order - add an x-spy-component custom element that records the order in which its callbacks are called (so that unit tests are easier to write) * improve the x-spy component * Update lifecycle tests. * modify tests to address all review suggestions * Merge remote-tracking branch 'origin/feature/23-lifecycle-events-review-suggestions' into kb/23_lifecycle-events * Test fixes. * Remove unnecessary return value.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As a developer I want to define handlers for navigation lifecycle events for a route component:
DoD:
onBeforeEnter
method, this method is called (during the resolve pass) every time before a navigation to the component happens.onBeforeEnter
method returns something (notnull
norundefined
), that return value is used as a resolve pass result for the component (instead of the component itself).onBeforeLeave
method, this method is called (during the resolve pass) every time before a navigation to the component happens.onBeforeLeave
method returns something (notnull
norundefined
), the resolve pass ends before actually navigating to where it was going to, and that return value is used as the resolve pass result.The common DoD applies.
The text was updated successfully, but these errors were encountered: