|
1 | | -# [0.5.0](https://github.com/ui-router/react/releases/tag/0.5.0) (2017-05-24) |
2 | | -Version 0.5.0 is based on @uirouter/core 5.3.0 and as such introduced a lot of new features and fixes, alongside some breaking changes. |
| 1 | +<a name="0.5.0"></a> |
| 2 | +# [0.5.0](https://github.com/ui-router/react/compare/0.4.0...v0.5.0) (2017-05-24) |
3 | 3 |
|
4 | | -[[full @uirouter/core 5.0.0 changelog]](https://github.com/ui-router/core/blob/master/CHANGELOG.md#500-2017-04-21) |
5 | 4 |
|
6 | | -### Breaking Changes |
7 | | -- Rename `Resolves` interface to `UIViewResolves` for consistency [(1047b84)](https://github.com/ui-router/react/commit/1047b843175b0459682ed03e36315afe4a175a0c). |
8 | | -- Rename `InjectedProps` interface to `UIViewResolves` for consistency [(1047b84)](https://github.com/ui-router/react/commit/1047b843175b0459682ed03e36315afe4a175a0c). |
| 5 | +### Bug Fixes |
| 6 | + |
| 7 | +* **UIRouter:** Apply config before registering states ([75f169a](https://github.com/ui-router/react/commit/75f169a)) |
| 8 | +* **rollup:** Allow rollup to process 'import * as classNames' ([8434883](https://github.com/ui-router/react/commit/8434883)), closes [#33](https://github.com/ui-router/react/issues/33) |
| 9 | + |
| 10 | + |
| 11 | +### Features |
| 12 | + |
| 13 | +* export everything from core alongside the react stuff ([6d0b49b](https://github.com/ui-router/react/commit/6d0b49b)), closes [#41](https://github.com/ui-router/react/issues/41) |
| 14 | +* **UIView:** add render prop API ([1047b84](https://github.com/ui-router/react/commit/1047b84)), closes [#35](https://github.com/ui-router/react/issues/35) [#26](https://github.com/ui-router/react/issues/26) [#13](https://github.com/ui-router/react/issues/13) |
| 15 | + |
| 16 | + |
| 17 | +### BREAKING CHANGES |
| 18 | + |
| 19 | +* UIView: Rename `Resolves` interface to `UIViewResolves` for |
| 20 | +consistency. |
| 21 | +* UIView: Rename `InjectedProps` interface to `UIViewResolves` |
| 22 | +for consistency. |
9 | 23 |
|
10 | | -[[take a look at the breaking changes brought by the new @uirouter/core]](https://github.com/ui-router/core/blob/master/CHANGELOG.md#breaking-changes) |
11 | 24 |
|
12 | | -### Changed |
13 | | -- **@uirouter/core**: Updated to version `5.3.0` [(5f60537)](https://github.com/ui-router/react/commit/5f605372a26a310282fa5ebc9f7bd04b480d34e9). |
14 | | -- **peerDependency**: move `react` and `prop-types` to `peerDependency` to fix warnings [(43b947f)](https://github.com/ui-router/react/commit/43b947f7bb2182457e090a3f67234e461d4a6dc7). |
15 | 25 |
|
16 | | -### Add |
17 | | -- **UIView**: Add new `render` function prop API.This new API lets you control how |
18 | | -the routed component is rendered by the `UIView` [(1047b84)](https://github.com/ui-router/react/commit/1047b843175b0459682ed03e36315afe4a175a0c): |
| 26 | +### @uirouter/core changes |
| 27 | +## [5.0.3](https://github.com/ui-router/core/compare/3.1.0...5.0.3) (2017-05-24) |
| 28 | + |
| 29 | + |
| 30 | +### Bug Fixes |
| 31 | + |
| 32 | +* **BrowserLocationConfig:** fixed protocol + port value ([#38](https://github.com/ui-router/core/issues/38)) ([5559382](https://github.com/ui-router/core/commit/5559382)) |
| 33 | +* **TransitionHook:** Transition hooks no longer expose the internal StateObject ([2b0e48b](https://github.com/ui-router/core/commit/2b0e48b)) |
| 34 | +* **common:** Fix implementation of 'pick' -- use hasOwnProperty ([09848a4](https://github.com/ui-router/core/commit/09848a4)) |
| 35 | +* **common:** Re-fix implementation of 'pick' using for .. in ([f2da7f4](https://github.com/ui-router/core/commit/f2da7f4)) |
| 36 | +* **lazyLoad:** Allow `lazyLoad` stateBuilder: Get lazyLoad fn from internal State object, not StateDeclaration ([9313880](https://github.com/ui-router/core/commit/9313880)) |
| 37 | +* **lazyLoad:** Wait for future state to be replaced before registering lazy children ([4bdce47](https://github.com/ui-router/core/commit/4bdce47)) |
| 38 | +* **noImplicitAny:** Fix noimplicitany compliance ([1a6cdfc](https://github.com/ui-router/core/commit/1a6cdfc)) |
| 39 | +* **pushStateLocation:** call listeners in url() ([#24](https://github.com/ui-router/core/issues/24)) ([7c90911](https://github.com/ui-router/core/commit/7c90911)), closes [#23](https://github.com/ui-router/core/issues/23) |
| 40 | +* **redirect:** Do not update URL after redirect with { location: false } ([652a760](https://github.com/ui-router/core/commit/652a760)) |
| 41 | +* **resolve:** Allow resolve's state context to be injected as `$state$` ([a06948b](https://github.com/ui-router/core/commit/a06948b)) |
| 42 | +* **tfs:** Rename $q.ts and $injector.ts files, removing leading dollar signs ([cb653ee](https://github.com/ui-router/core/commit/cb653ee)) |
| 43 | +* **trace:** Re-add transitionStart trace ([b019036](https://github.com/ui-router/core/commit/b019036)) |
| 44 | +* **transition:** Do not ignore transitions which have states being entered or exited ([175717e](https://github.com/ui-router/core/commit/175717e)) |
| 45 | +* **transitionHook:** Do not process transition hooks after router has been disposed. ([666c6d7](https://github.com/ui-router/core/commit/666c6d7)) |
| 46 | +* **typings:** Allow strictNullChecks for HookMatchCriteria ([d92d4d5](https://github.com/ui-router/core/commit/d92d4d5)) |
| 47 | +* **ui-sref:** Improve performance of generating hrefs ([c3967bd](https://github.com/ui-router/core/commit/c3967bd)) |
| 48 | +* **view:** Do not throw when uiView doesn't have a state context ([f76ee2a](https://github.com/ui-router/core/commit/f76ee2a)) |
| 49 | +* **view:** Update views in order of ui-view depth and also by state depth ([46dea2b](https://github.com/ui-router/core/commit/46dea2b)) |
| 50 | + |
| 51 | + |
| 52 | +### Features |
| 53 | + |
| 54 | +* **Globals:** implement Disposable and delete global transition data ([a794018](https://github.com/ui-router/core/commit/a794018)) |
| 55 | +* **Rejection:** Add $id to ease debugging of transition rejections ([d456d54](https://github.com/ui-router/core/commit/d456d54)) |
| 56 | +* **State:** Support registration of ES6 state classes (as opposed to object literals) ([3a5d055](https://github.com/ui-router/core/commit/3a5d055)) |
| 57 | +* **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) |
| 58 | +* **StateObject:** Rename internal `State` object to `StateObject` ([feceaf9](https://github.com/ui-router/core/commit/feceaf9)) |
| 59 | +* **StateRegistry:** improve perf for: `.register()` and `StateMatcher.find()` misses ([fdb3ab9](https://github.com/ui-router/core/commit/fdb3ab9)) |
| 60 | +* **Transition:** Normalize all transition errors to a Rejection. ([a7464bb](https://github.com/ui-router/core/commit/a7464bb)) |
| 61 | +* **Transition:** deprecate `Transition.is()` which was never implemented ([1edff4b](https://github.com/ui-router/core/commit/1edff4b)) |
| 62 | +* **UIRouter:** Add `trace` global to the `UIRouter` object ([48c5af6](https://github.com/ui-router/core/commit/48c5af6)) |
| 63 | +* **UrlService:** (`UrlRouter`) improve perf of registering Url Rules and sorting Url Rules ([64fbfff](https://github.com/ui-router/core/commit/64fbfff)) |
| 64 | +* **UrlService:** Add `rules.initial("/home")` to config initial state (like otherwise) ([bbe4209](https://github.com/ui-router/core/commit/bbe4209)) |
| 65 | +* **View:** Allow targeting views on own state using `viewname@.` (normalizeUIViewTarget) ([7078216](https://github.com/ui-router/core/commit/7078216)), closes [#25](https://github.com/ui-router/core/issues/25) |
| 66 | +* **abort:** Add API to manually abort/cancel a transition ([39f8a53](https://github.com/ui-router/core/commit/39f8a53)) |
| 67 | +* **build:** Build and distribute UMD bundles ([0a8da85](https://github.com/ui-router/core/commit/0a8da85)) |
| 68 | +* **common:** Perf improvements in hot functions: ([4193244](https://github.com/ui-router/core/commit/4193244)) |
| 69 | +* **core:** Export all vanilla.* code from `ui-router-core` ([f3392d1](https://github.com/ui-router/core/commit/f3392d1)) |
| 70 | +* **core:** Switch to [@uirouter](https://github.com/uirouter)/core npm module ([e3f389f](https://github.com/ui-router/core/commit/e3f389f)) |
| 71 | +* **decorators:** Add state, resolve and resolve data decorators ([642df0b](https://github.com/ui-router/core/commit/642df0b)) |
| 72 | +* **defaultErrorHandler:** Do not invoke default error handler for ABORTED transitions ([b07a24b](https://github.com/ui-router/core/commit/b07a24b)) |
| 73 | +* **globals:** Removed `UIRouterGlobals` interface. Renamed `Globals` class to `UIRouterGlobals` ([8719334](https://github.com/ui-router/core/commit/8719334)) |
| 74 | +* **onBefore:** Run onBefore hooks asynchronously. ([30b82aa](https://github.com/ui-router/core/commit/30b82aa)) |
| 75 | +* **onEnter/Exit/Retain:** Use onExit/onEnter/onRetain from 56955state(), not state.self ([bc1f554](https://github.com/ui-router/core/commit/bc1f554)) |
| 76 | +* **transition:** Ignore duplicate transitions (double clicks) ([bd1bd0b](https://github.com/ui-router/core/commit/bd1bd0b)) |
| 77 | +* **transition:** Improve supersede logic: Do not supersede if the new trans is aborted before onStart ([3141a8f](https://github.com/ui-router/core/commit/3141a8f)) |
| 78 | +* **transition:** Run hooks synchronously in current stack, when possible ([953e618](https://github.com/ui-router/core/commit/953e618)) |
| 79 | + |
| 80 | + |
| 81 | +### BREAKING CHANGES |
| 82 | + |
| 83 | +### **TransitionHook:** Transition hooks no longer expose the internal `State` object (now named `StateObject`) |
| 84 | + |
| 85 | +#### Before: |
| 86 | + |
| 87 | +```js |
| 88 | +import { State } from "ui-router-core"; |
| 89 | +const match = { to: (state: State) => state.data.auth }; |
| 90 | +transitionsvc.onEnter(match, (trans: Transition, state: State) => { |
| 91 | + // state is the internal State object |
| 92 | + if (state.includes["foo"]) { // internal ui-router API |
| 93 | + return false; |
| 94 | + } |
| 95 | +} |
| 96 | +``` |
| 97 | +
|
| 98 | +#### Now: |
| 99 | +
|
| 100 | +```js |
| 101 | +import { StateDeclaration } from "@uirouter/react"; |
| 102 | +const match = { to: (state: StateDeclaration) => state.data.auth }; |
| 103 | +transitionsvc.onEnter(match, (trans: Transition, state: StateDeclaration) => { |
| 104 | + // state === the state object you registered |
| 105 | + // Access internal ui-router API using $$state() |
| 106 | + if (state.$$state().includes["foo"]) { |
| 107 | + return false; |
| 108 | + } |
| 109 | +} |
| 110 | +``` |
| 111 | +
|
| 112 | +#### Motivation: |
| 113 | +
|
| 114 | +The `State` object (now named `StateObject`) is an internal API and should not be exposed via any public APIs. |
| 115 | +If you depend on the internal APIs, you can still access the internal object by calling `state.$$state()`. |
| 116 | +
|
| 117 | +### **StateObject:** Renamed internal API `State` object to `StateObject` |
| 118 | +
|
| 119 | +#### Before: |
| 120 | +
|
| 121 | +```js |
| 122 | +import {State} from "ui-router-core"; |
| 123 | +``` |
| 124 | +
|
| 125 | +#### Now: |
| 126 | +
|
| 127 | +```js |
| 128 | +import {StateObject} from "@uirouter/react"; |
| 129 | +``` |
| 130 | +
|
| 131 | +#### Motivation: |
| 132 | +
|
| 133 | +We'd like to use the `State` name/symbol as a public API. It will be an |
| 134 | +ES7/TS decorator for ES6/TS state definition classes, i.e: |
| 135 | +
|
| 136 | +```js |
| 137 | +@State("foo") |
| 138 | +export class FooState implements StateDeclaration { |
| 139 | + url = "/foo"; |
| 140 | + component = FooComponent; |
| 141 | + |
| 142 | + @Resolve({ deps: [FooService] }) |
| 143 | + fooData(fooService) { |
| 144 | + return fooService.getFoos(); |
| 145 | + } |
| 146 | +} |
| 147 | +``` |
| 148 | +
|
| 149 | +### **Transition:** All Transition errors are now wrapped in a Rejection object. |
| 150 | +
|
| 151 | +#### Before: |
| 152 | +
|
| 153 | +Previously, if a transition hook returned a rejected promise: |
| 154 | +```js |
| 155 | +.onStart({}, () => Promise.reject('reject transition')); |
| 156 | +``` |
| 157 | +
|
| 158 | +In `onError` or `transtion.promise.catch()`, the raw rejection was returned: |
| 159 | +```js |
| 160 | +.onError({}, (trans, err) => err === 'reject transition') |
| 161 | +``` |
| 162 | +
|
| 163 | +#### Now: |
| 164 | +
|
| 165 | +Now, the error is wrapped in a Rejection object. |
| 166 | +
|
| 167 | +- The detail (thrown error or rejected value) is still available as `.detail`. |
| 168 | +
|
| 169 | +```js |
| 170 | +.onError({}, (trans, err) => |
| 171 | + err instanceof Rejection && err.detail === 'reject transition') |
| 172 | +``` |
| 173 | +
|
| 174 | +- The Rejection object indicates the `.type` of transition rejection (ABORTED, ERROR, SUPERSEDED and/or redirection). |
| 175 | +```js |
| 176 | +.onError({}, (trans, err) => { |
| 177 | + err.type === RejectType.ABORTED === 3 |
| 178 | +}); |
| 179 | +``` |
| 180 | +
|
| 181 | +#### Motivation: |
| 182 | +
|
| 183 | +Errors *thrown from* a hook and rejection values *returned from* a hook can now be processed in the same way. |
| 184 | +
|
| 185 | +### **onBefore:** `onBefore` hooks are now run asynchronously like all the other hooks. |
| 186 | +
|
| 187 | +#### Old behavior |
| 188 | +
|
| 189 | +Previously, the `onBefore` hooks were run in the same stackframe as `transitionTo`. |
| 190 | +If they threw an error, it could be caught using try/catch. |
| 191 | +
|
| 192 | +```js |
| 193 | +transitionService.onBefore({ to: 'foo' }), () => { throw new Error('doh'); }); |
| 194 | +try { |
| 195 | + stateService.go('foo'); |
| 196 | +} catch (error) { |
| 197 | + // handle error |
| 198 | +} |
| 199 | +``` |
| 200 | +
|
| 201 | +#### New behavior |
| 202 | +
|
| 203 | +Now, `onBefore` hooks are processed asynchronously. |
| 204 | +To handle errors, use any of the async error handling paradigms: |
| 205 | +
|
| 206 | +- Chain off the promise |
| 207 | + ```js |
| 208 | + transitionService.onBefore({ to: 'foo' }), () => { throw new Error('doh'); }); |
| 209 | + stateService.go('foo').catch(error => { //handle error }); |
| 210 | + ``` |
| 211 | +- Define an error handler |
| 212 | + ```js |
| 213 | + transitionService.onBefore({ to: 'foo' }), () => { throw new Error('doh'); }); |
| 214 | + transitionService.onError({ to: 'foo' }), () => { // handle error }); |
| 215 | + stateService.go('foo'); |
| 216 | + ``` |
| 217 | +- Use the global defaultErrorHandler |
| 218 | + ```js |
| 219 | + transitionService.onBefore({ to: 'foo' }), () => { throw new Error('doh'); }); |
| 220 | + stateService.go('foo'); |
| 221 | + stateService.defaultErrorHandler(error => { // global error handler }); |
| 222 | + ``` |
| 223 | +
|
| 224 | +#### Motivation |
| 225 | +
|
| 226 | +Why introduce a BC? |
| 227 | +
|
| 228 | +- No subtle behavior differences by hook type |
| 229 | +- Simpler code and mental model |
| 230 | +- Fewer edge cases to account for |
| 231 | +
|
| 232 | +### **defaultErrorHandler:** ABORTED transitions do not invoke the `defaultErrorHandler` |
| 233 | +
|
| 234 | +Returning `false` from a transition hook will abort the transition. |
| 235 | +
|
| 236 | +#### Old behavior |
| 237 | +
|
| 238 | +Previously, this case was considered an error and was logged by |
| 239 | +`defaultErrorHandler`. |
| 240 | +After your feedback, we agree that this is not typically an error. |
| 241 | +
|
| 242 | +#### New behavior |
| 243 | +
|
| 244 | +Now, aborted transitions do not trigger the `defaultErrorHandler` |
19 | 245 |
|
20 | | - ```jsx |
21 | | - <UIView render={(Comp, props) => <Comp {…props} />} /> |
22 | | - ``` |
23 | | -- **cross-env**: Add `cross-env` package to support Windows development [(f7e26cd)](https://github.com/ui-router/react/commit/f7e26cdfb76f6a76f52cb39139f1f2e51e2801db). |
| 246 | +#### Motivation |
24 | 247 |
|
| 248 | +Most users do not consider ABORT to be an error. The default error |
| 249 | +handler should match this assumption. |
25 | 250 |
|
26 | 251 | # [0.4.0](https://github.com/ui-router/react/releases/tag/0.4.0) (2017-01-10) |
27 | 252 | Version 0.4.0 is based on ui-router-ore 3.1.0 and as such introduced a lot of new features/fixes alongside some breaking changes. |
|
0 commit comments