|
| 1 | +<a name="1.0.0-beta.5"></a> |
| 2 | +# [1.0.0-beta.5](https://github.com/ui-router/ng2/compare/1.0.0-beta.4...1.0.0-beta.5) (2017-04-22) |
| 3 | + |
| 4 | + |
| 5 | +### Bug Fixes |
| 6 | + |
| 7 | +* **bindings:** Make `bindings:` work on a state declaration (as well as a view declaration) ([a21c479](https://github.com/ui-router/ng2/commit/a21c479)) |
| 8 | +* **bundle:** Only bundle ui-router-ng2 code (do not bundle ui-router-core) ([a285218](https://github.com/ui-router/ng2/commit/a285218)) |
| 9 | +* **bundle:** work around rollup bug https://github.com/rollup/rollup/issues/1322 ([89884b9](https://github.com/ui-router/ng2/commit/89884b9)) |
| 10 | +* **lazyLoad:** Supply native injector to lazy loaded states ([ebce639](https://github.com/ui-router/ng2/commit/ebce639)) |
| 11 | +* **Ng2LocationServices:** Ignore duplicated 'hashchange' event in favor of 'popstate' event ([82a3e2e](https://github.com/ui-router/ng2/commit/82a3e2e)) |
| 12 | +* **NgModule:** De-dupe states loaded from NgModule ([ffe85cb](https://github.com/ui-router/ng2/commit/ffe85cb)) |
| 13 | +* **package.json:** Fix engines in package.json ([b2d828a](https://github.com/ui-router/ng2/commit/b2d828a)) |
| 14 | +* **rxjs:** Fix missing RxJS operators in tree-shaked apps ([5f03719](https://github.com/ui-router/ng2/commit/5f03719)) |
| 15 | +* **rxjs:** import rxjs operators. ([26a74ef](https://github.com/ui-router/ng2/commit/26a74ef)) |
| 16 | +* **uiSref:** avoid empty links ([#26](https://github.com/ui-router/ng2/issues/26)) ([5f6870d](https://github.com/ui-router/ng2/commit/5f6870d)) |
| 17 | + |
| 18 | + |
| 19 | +### Features |
| 20 | + |
| 21 | +* **bindings:** Apply explicit bindings even when no `[@Input](https://github.com/Input)()` found. ([4351c53](https://github.com/ui-router/ng2/commit/4351c53)) |
| 22 | +* **config:** Pass the module object to the module config function ([e9705b0](https://github.com/ui-router/ng2/commit/e9705b0)) |
| 23 | +* **Ng2LocationConfig:** use BrowserLocationConfig. ([7e0aef6](https://github.com/ui-router/ng2/commit/7e0aef6)) |
| 24 | +* **uiCanExit:** Add `uiCanExit` hook for routed components ([633573e](https://github.com/ui-router/ng2/commit/633573e)) |
| 25 | + |
| 26 | +### Reverts |
| 27 | + |
| 28 | +* **ResolveData:** Remove [@ResolveData](https://github.com/ResolveData) decorator ([0c8226d](https://github.com/ui-router/ng2/commit/0c8226d)) |
| 29 | + |
| 30 | +### BREAKING CHANGES |
| 31 | + |
| 32 | +## **bundle:** We no longer bundle the core nor rx code in the UMD bundle. |
| 33 | + |
| 34 | +Previously, the `ui-router-ng2` bundle included the code from `ui-router-core` and `ui-router-rx`. |
| 35 | +Now, each UMD bundle must be included separately. |
| 36 | + |
| 37 | +This change is most likely to affect: |
| 38 | + |
| 39 | +- SystemJS projects |
| 40 | +- projects that do not bundle (but ship pre-built UMD bundles) |
| 41 | +- Users of ui-router plugins that import ui-router-core, such as sticky-states. |
| 42 | + |
| 43 | + |
| 44 | +### @ui-router/core changes |
| 45 | +# [5.0.0](https://github.com/ui-router/core/compare/4.0.0...5.0.0) (2017-04-22) |
| 46 | + |
| 47 | +This release of `@uirouter/angular` updates `@uirouter/core` from `4.0.0` to `5.0.0`. |
| 48 | +Here are the changes from core: |
| 49 | + |
| 50 | +### Bug Fixes |
| 51 | + |
| 52 | +* **BrowserLocationConfig:** fixed protocol + port value ([#38](https://github.com/ui-router/core/issues/38)) ([5559382](https://github.com/ui-router/core/commit/5559382)) |
| 53 | +* **lazyLoad:** Wait for future state to be replaced before registering lazy children ([4bdce47](https://github.com/ui-router/core/commit/4bdce47)) |
| 54 | +* **noImplicitAny:** Fix noimplicitany compliance ([1a6cdfc](https://github.com/ui-router/core/commit/1a6cdfc)) |
| 55 | +* **redirect:** Do not update URL after redirect with { location: false } ([652a760](https://github.com/ui-router/core/commit/652a760)) |
| 56 | +* **tfs:** Rename $q.ts and $injector.ts files, removing leading dollar signs ([cb653ee](https://github.com/ui-router/core/commit/cb653ee)) |
| 57 | +* **trace:** Re-add transitionStart trace ([b019036](https://github.com/ui-router/core/commit/b019036)) |
| 58 | +* **TransitionHook:** Do not process transition hooks after router has been disposed. ([666c6d7](https://github.com/ui-router/core/commit/666c6d7)) |
| 59 | +* **TransitionHook:** Transition hooks no longer expose the internal StateObject ([2b0e48b](https://github.com/ui-router/core/commit/2b0e48b)) |
| 60 | +* **typings:** Allow strictNullChecks for HookMatchCriteria ([d92d4d5](https://github.com/ui-router/core/commit/d92d4d5)) |
| 61 | +* **ui-sref:** Improve performance of generating hrefs ([c3967bd](https://github.com/ui-router/core/commit/c3967bd)) |
| 62 | +* **view:** Do not throw when uiView doesn't have a state context ([f76ee2a](https://github.com/ui-router/core/commit/f76ee2a)) |
| 63 | +* **view:** Update views in order of ui-view depth and also by state depth ([46dea2b](https://github.com/ui-router/core/commit/46dea2b)) |
| 64 | + |
| 65 | + |
| 66 | +### Features |
| 67 | + |
| 68 | +* **abort:** Add API to manually abort/cancel a transition ([39f8a53](https://github.com/ui-router/core/commit/39f8a53)) |
| 69 | +* **common:** Perf improvements in hot functions: ([4193244](https://github.com/ui-router/core/commit/4193244)) |
| 70 | +* **core:** Switch to [@uirouter/core](https://github.com/uirouter/core) npm module ([e3f389f](https://github.com/ui-router/core/commit/e3f389f)) |
| 71 | +* **defaultErrorHandler:** Do not invoke default error handler for ABORTED transitions ([b07a24b](https://github.com/ui-router/core/commit/b07a24b)) |
| 72 | +* **Globals:** implement Disposable and delete global transition data ([a794018](https://github.com/ui-router/core/commit/a794018)) |
| 73 | +* **onBefore:** Run onBefore hooks asynchronously. ([30b82aa](https://github.com/ui-router/core/commit/30b82aa)) |
| 74 | +* **onEnter/Exit/Retain:** Use onExit/onEnter/onRetain from StateObject, not state.self ([bc1f554](https://github.com/ui-router/core/commit/bc1f554)) |
| 75 | +* **Rejection:** Add $id to ease debugging of transition rejections ([d456d54](https://github.com/ui-router/core/commit/d456d54)) |
| 76 | +* **State:** Switch Internal State Object to prototypally inherit from the State Declaration ([027c995](https://github.com/ui-router/core/commit/027c995)), closes [#34](https://github.com/ui-router/core/issues/34) |
| 77 | +* **StateObject:** Rename internal `State` object to `StateObject` ([feceaf9](https://github.com/ui-router/core/commit/feceaf9)) |
| 78 | +* **StateRegistry:** improve perf for: `.register()` and `StateMatcher.find()` misses ([fdb3ab9](https://github.com/ui-router/core/commit/fdb3ab9)) |
| 79 | +* **Transition:** Ignore duplicate transitions (double clicks) ([bd1bd0b](https://github.com/ui-router/core/commit/bd1bd0b)) |
| 80 | +* **Transition:** Improve supersede logic: Do not supersede if the new trans is aborted before onStart ([3141a8f](https://github.com/ui-router/core/commit/3141a8f)) |
| 81 | +* **Transition:** Run hooks synchronously in current stack, when possible ([953e618](https://github.com/ui-router/core/commit/953e618)) |
| 82 | +* **Transition:** Normalize all transition errors to a Rejection. ([a7464bb](https://github.com/ui-router/core/commit/a7464bb)) |
| 83 | +* **UrlService:** (`UrlRouter`) improve perf of registering Url Rules and sorting Url Rules ([64fbfff](https://github.com/ui-router/core/commit/64fbfff)) |
| 84 | +* **UrlService:** Add `rules.initial("/home")` to config initial state (like otherwise) ([bbe4209](https://github.com/ui-router/core/commit/bbe4209)) |
| 85 | + |
| 86 | + |
| 87 | +### BREAKING CHANGES |
| 88 | + |
| 89 | +## **TransitionHook:** Transition hooks no longer expose the internal `State` object (now named `StateObject`) |
| 90 | + |
| 91 | +#### Before: |
| 92 | + |
| 93 | +```js |
| 94 | +import { State } from "ui-router-core"; |
| 95 | +const match = { to: (state: State) => state.data.auth }; |
| 96 | +transitionsvc.onEnter(match, (trans: Transition, state: State) => { |
| 97 | + // state is the internal State object |
| 98 | + if (state.includes["foo"]) { // internal ui-router API |
| 99 | + return false; |
| 100 | + } |
| 101 | +} |
| 102 | +``` |
| 103 | + |
| 104 | +#### Now: |
| 105 | + |
| 106 | +```js |
| 107 | +import { StateDeclaration } from "ui-router-core"; |
| 108 | +const match = { to: (state: StateDeclaration) => state.data.auth }; |
| 109 | +transitionsvc.onEnter(match, (trans: Transition, state: StateDeclaration) => { |
| 110 | + // state === the state object you registered |
| 111 | + // Access internal ui-router API using $$state() |
| 112 | + if (state.$$state().includes["foo"]) { |
| 113 | + return false; |
| 114 | + } |
| 115 | +} |
| 116 | +``` |
| 117 | + |
| 118 | +#### Motivation: |
| 119 | + |
| 120 | +The `State` object (now named `StateObject`) is an internal API and should not be exposed via any public APIs. |
| 121 | +If you depend on the internal APIs, you can still access the internal object by calling `state.$$state()`. |
| 122 | + |
| 123 | +#### BC Likelihood |
| 124 | + |
| 125 | +How likely is this BC to affect me? |
| 126 | + |
| 127 | +Medium: You will likely be affected you 1) have transition hooks, 2) are using typescript and/or 3) use the internal ui-router State API. |
| 128 | + |
| 129 | +#### BC Severity |
| 130 | + |
| 131 | +How severe is this BC? |
| 132 | + |
| 133 | +Low: Access to the internal api is still available using `$$state()`. |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | + |
| 138 | +## **StateObject:** Renamed internal API `State` object to `StateObject` |
| 139 | + |
| 140 | +#### Before: |
| 141 | + |
| 142 | +``` |
| 143 | +import {State} from "ui-router-core"; |
| 144 | +``` |
| 145 | + |
| 146 | +#### Now: |
| 147 | + |
| 148 | +``` |
| 149 | +import {StateObject} from "ui-router-core"; |
| 150 | +``` |
| 151 | + |
| 152 | +#### Motivation: |
| 153 | + |
| 154 | +We'd like to use the `State` name/symbol as a public API. |
| 155 | +Some day (not today) it will likely be an ES7/TS decorator for ES6/TS state definition classes, i.e: |
| 156 | + |
| 157 | +```js |
| 158 | +@State("foo") |
| 159 | +export class FooState implements StateDeclaration { |
| 160 | + url = "/foo"; |
| 161 | + component = FooComponent; |
| 162 | + |
| 163 | + @Resolve({ deps: [FooService] }) |
| 164 | + fooData(fooService) { |
| 165 | + return fooService.getFoos(); |
| 166 | + } |
| 167 | +} |
| 168 | +``` |
| 169 | + |
| 170 | +#### BC Likelihood |
| 171 | + |
| 172 | +How likely is this to affect me? |
| 173 | + |
| 174 | +Low: This only affects code that imports the internal API symbol `State`. |
| 175 | +You will likely be affected you 1) import that symbol, 2) are using typescript and 3) explicitly |
| 176 | +typed a variable such as `let internalStateObject = state.$$state();` |
| 177 | + |
| 178 | +#### BC Severity |
| 179 | + |
| 180 | +How severe is this change? |
| 181 | + |
| 182 | +Low: Find all places where `State` is imported and rename to `StateObject` |
| 183 | + |
| 184 | + |
| 185 | +## **Transition:** All Transition errors are now wrapped in a Rejection object. |
| 186 | + |
| 187 | +#### Before: |
| 188 | + |
| 189 | +Previously, if a transition hook returned a rejected promise: |
| 190 | +```js |
| 191 | +.onStart({}, () => Promise.reject('reject transition')); |
| 192 | +``` |
| 193 | + |
| 194 | +In `onError` or `transtion.promise.catch()`, the raw rejection was returned: |
| 195 | +```js |
| 196 | +.onError({}, (trans, err) => err === 'reject transition') |
| 197 | +``` |
| 198 | + |
| 199 | +#### Now: |
| 200 | + |
| 201 | +Now, the error is wrapped in a Rejection object. |
| 202 | + |
| 203 | +- The detail (thrown error or rejected value) is still available as `.detail`. |
| 204 | + |
| 205 | +```js |
| 206 | +.onError({}, (trans, err) => |
| 207 | + err instanceof Rejection && err.detail === 'reject transition') |
| 208 | +``` |
| 209 | + |
| 210 | +- The Rejection object indicates the `.type` of transition rejection (ABORTED, ERROR, SUPERSEDED and/or redirection). |
| 211 | +```js |
| 212 | +.onError({}, (trans, err) => { |
| 213 | + err.type === RejectType.ABORTED === 3 |
| 214 | +}); |
| 215 | +``` |
| 216 | + |
| 217 | +#### Motivation: |
| 218 | + |
| 219 | +Errors *thrown from* a hook and rejection values *returned from* a hook can now be processed in the same way. |
| 220 | + |
| 221 | +#### BC Likelihood |
| 222 | + |
| 223 | +How likely is this to affect me? |
| 224 | + |
| 225 | +Medium: apps which have onError handlers for rejected values |
| 226 | + |
| 227 | +#### BC Severity |
| 228 | + |
| 229 | +How severe is this change? |
| 230 | + |
| 231 | +Low: Find all error handlers (or .catch/.then chains) that do not understand Rejection. Add `err.detail` processing. |
| 232 | + |
| 233 | + |
| 234 | +## **onBefore:** `onBefore` hooks are now run asynchronously like all the other hooks. |
| 235 | + |
| 236 | +#### Old behavior |
| 237 | + |
| 238 | +Previously, the `onBefore` hooks were run in the same stackframe as `transitionTo`. |
| 239 | +If they threw an error, it could be caught using try/catch. |
| 240 | + |
| 241 | +```js |
| 242 | +transitionService.onBefore({ to: 'foo' }), () => { throw new Error('doh'); }); |
| 243 | +try { |
| 244 | + stateService.go('foo'); |
| 245 | +} catch (error) { |
| 246 | + // handle error |
| 247 | +} |
| 248 | +``` |
| 249 | + |
| 250 | +#### New behavior |
| 251 | + |
| 252 | +Now, `onBefore` hooks are processed asynchronously. |
| 253 | +To handle errors, use any of the async error handling paradigms: |
| 254 | + |
| 255 | +- Chain off the promise |
| 256 | + ```js |
| 257 | + transitionService.onBefore({ to: 'foo' }), () => { throw new Error('doh'); }); |
| 258 | + stateService.go('foo').catch(error => { //handle error }); |
| 259 | + ``` |
| 260 | +- Define an error handler |
| 261 | + ```js |
| 262 | + transitionService.onBefore({ to: 'foo' }), () => { throw new Error('doh'); }); |
| 263 | + transitionService.onError({ to: 'foo' }), () => { // handle error }); |
| 264 | + stateService.go('foo'); |
| 265 | + ``` |
| 266 | +- Use the global defaultErrorHandler |
| 267 | + ```js |
| 268 | + transitionService.onBefore({ to: 'foo' }), () => { throw new Error('doh'); }); |
| 269 | + stateService.go('foo'); |
| 270 | + stateService.defaultErrorHandler(error => { // global error handler }); |
| 271 | + ``` |
| 272 | + |
| 273 | +#### Motivation |
| 274 | + |
| 275 | +Why introduce a BC? |
| 276 | + |
| 277 | +- No subtle behavior differences by hook type |
| 278 | +- Simpler code and mental model |
| 279 | +- Fewer edge cases to account for |
| 280 | + |
| 281 | +#### BC Liklihood |
| 282 | + |
| 283 | +How likely is this to affect my app? |
| 284 | + |
| 285 | +Very Low: Apps that registered onBefore hooks and depend on |
| 286 | +synchronous execution are affected. |
| 287 | + |
| 288 | +#### BC Severity |
| 289 | + |
| 290 | +How severe is this BC? |
| 291 | + |
| 292 | +Low: Switch to asynchronous handling, such as chaining off the |
| 293 | +transition promise |
| 294 | + |
| 295 | + |
| 296 | +## **defaultErrorHandler:** ABORTED transitions do not invoke the `defaultErrorHandler` |
| 297 | + |
| 298 | +Returning `false` from a transition hook will abort the transition. |
| 299 | + |
| 300 | +#### Old behavior |
| 301 | + |
| 302 | +Previously, this case was considered an error and was logged by |
| 303 | +`defaultErrorHandler`. |
| 304 | +After your feedback, we agree that this is not typically an error. |
| 305 | + |
| 306 | +#### New behavior |
| 307 | + |
| 308 | +Now, aborted transitions do not trigger the `defaultErrorHandler` |
| 309 | + |
| 310 | +#### Motivation: |
| 311 | + |
| 312 | +> Why introduce a BC? |
| 313 | + |
| 314 | +Most users do not consider ABORT to be an error. The default error |
| 315 | +handler should match this assumption. |
| 316 | + |
| 317 | +#### BC liklihood |
| 318 | + |
| 319 | +> How likely am I to be affected? |
| 320 | + |
| 321 | +Low: Most users do not consider ABORT to be an error. For most users |
| 322 | +this will not be a BC. |
| 323 | + |
| 324 | +#### BC severity |
| 325 | + |
| 326 | +> How severe is this BC? |
| 327 | + |
| 328 | +Low: Users who want to handle all transition rejections can |
| 329 | +register a `.onError` handler and filter/process accordingly. |
| 330 | + |
| 331 | + |
| 332 | + |
1 | 333 | <a name="1.0.0-beta.4"></a>
|
2 | 334 | # [1.0.0-beta.4](https://github.com/ui-router/ng2/compare/1.0.0-beta.3...1.0.0-beta.4) (2017-01-22)
|
3 | 335 |
|
|
0 commit comments