- Ensure joined routes are slash-separated. Thanks @jsg2021. Ref: #205
- Various dev updates & rebuilds.
- Use
UNSAFE_componentWillReceiveProps
for React >= 16.3.- #215 contains work in progress to move to
static getDerivedStateFromProps()
.
- #215 contains work in progress to move to
- Rem
@providesModule
from copiedwarning.js
which can cause issues with Flow/RN.
- React 16 support.
- Note: React 16 inverts the call order of
setState(obj, cb)
. Parent components' callbacks are now called first, where they previously were last.
- Note: React 16 inverts the call order of
- Bugfix: Don't drop querystring from
<CaptureClicks>
.
- Import
create-react-class
andprop-types
to deal with React 15.5 warnings. Thanks @curquhart
- Fix a few unknown props errors. Thanks @BlakeRxxk. Ref: #178, #181
- Update dev dependencies.
- Add the ability to decode named segments in routes before they are given as props to handlers. See the url pattern docs.
- Reduce npm tarball size by 80% (excluding docs, examples, etc)
- Remove usage of
React.DOM.*
, which will soon be deprecated in React 16 and has incompatibilities with Preact, Inferno, etc.
- Fix
component
propType. Thanks @jsg2021.
- Router: Avoid unnecessary
setPath()
calls when receiving identical props. Fixes #177 - CaptureClicks: Potentially breaking change:
- Previously,
<CaptureClicks>
would callprops.gotoURL()
(default:window.location.href = e.href
) as soon as the first router failed to match. This was error-prone as it depended on the registration order of routers. Subrouters with limited routes could cause navigation not to occur.- This was masked somewhat by the extraenous
setPath()
calls. Navigation would occur, butonNavigation
would not fire.
- This was masked somewhat by the extraenous
- Now,
<CaptureClicks>
callsprops.gotoURL()
only if all routers fail to match.
- Previously,
- Update for React v15.2.0: attempt to pass fewer unknown props to DOM elements.
- Tighten up some missing
propTypes
.
- Update dependencies.
- Move to Babel 6.
- Possibly breaking changes to callbacks:
onNavigation
andonBeforeNavigation
is now called on all routers.- This fixes #95
- Arity change in callbacks: now
(path, navigation, match)
from(path, navigation)
.- The trailing
match
parameter was added to better track subrouter matches. navigation
will no longer contain amatch
attribute, which was a singleton and thus could not be unique when using multiple routers.
- The trailing
- Hotfix: Accidental 'const', we're not using Babel
- Reuse empty
_query
objects as not to bust ShouldComponentUpdate.
- React v15 support. React 0.14 support will remain for some time.
- Remove
react/lib/batchedUpdates
require(), which was causing issues with CDN users.
- Fix import of
batchedUpdates
(currently ReactDOM.unstable_batchedUpdates) for use with the CDN version of React.
- Remove an errant 'let' that made its way into the build.
- Bugfix for
'#'
ignoring.
- Allow returning
false
from<CaptureClicks>
'sonClick
handler to completely cancel an anchor navigation. - Ignore
'#'
by default in<CaptureClicks>
, unless we're in a hash routing environment.
- Also pass (path, navigation) to onNavigation to match onBeforeNavigation.
- Support omitting the router's wrapping component entirely by passing a falsy
component
prop.
- Fix typo in previous commit
- Minor: Prevent
:focus
from sticking on clicked anchors under<CaptureClicks>
.
- Added optional
childProps
hash to the Router. If this is specified, these props will be passed to all handlers, contextual routers, and their children. Props defined on a handler or Route directly have priority. This fixes #104. - Possibly Breaking Change/Bugfix:
- We allow passing an actual element as a handler, not just a component. Previously, props on these
elements were lost, so that
<Location handler={<div className="foo" />} />
would render<div></div>
. This was unintentional and these inner props are now preserved and have priority overchildProps
or properties defined on the Route.
- We allow passing an actual element as a handler, not just a component. Previously, props on these
elements were lost, so that
- Fix querystring not being properly passed in
PathnameEnvironment
. Incremented minor in case of potential unexpected_query
attribute.
- Switch Object.assign shims, 'object.assign' uses eval()
- Bugfixes for
urlPatternOptions
, which was not properly being passed tomatchRoutes
in some cases. urlPatternOptions
now propagates down the contextual router hierarchy.- Added additional tests for
urlPatternOptions
.
- Breaking Changes (see also 0.27.0-rc1 changelog):
- Support for React 0.14.0 only.
url-pattern
0.10
brought breaking updates. If you are customizingurl-pattern
, there is a new API:createURLPatternCompiler()
andsetCreateURLPatternCompilerFactory()
have been removed.- Instead, pass an object at the prop
urlPatternOptions
on either your router or individual routes. Route-level options will be merged with precedence over Router options. Contextual router options are not merged between levels.
matchKeys
has been deprecated.url-pattern
now handles this natively; pass an array as the propurlPatternOptions
when using a regex.
- Breaking Changes:
- Remove React-Async and AsyncRouteRenderingMixin.
- Async support will be re-added via a plugin. See #129 for tracking on this issue.
- Remove React-Async and AsyncRouteRenderingMixin.
- Support for React 0.14.0-rc1.
- Dependency cleanup.
- Support querystrings.
- Querystrings are not matched - they are stripped before matching patterns.
- Querystrings, if present, are parsed and passed as the
_query
prop. - See the querystring docs.
- More ES6 fixes.
- Hotfix: adjust API for url-pattern to fit ES6 modules.
- Allow overriding url-pattern's compiler.
- Remove bad ReactComponent typecheck on Route/Location.
- Better React 0.13 support without typechecking errors.
- Send (path, navigation, cb) - don't lose
navigation
object. - Update dependencies (urllite, url-pattern, etc).
- Adjust for new
url-pattern
API. - Use React.batchedUpdates (now exposed on React object)
- Documentation fixes.
- Update react-async version.
- Support React 0.13 in peerDependencies.
- Fix LocalStorageEnvironment failure in browsers' private modes. Android, iOS, and Safari all keep LocalStorage available, but throw when you use it.
- Infinite loop fix when getting parent router in alternative environment.
- Set default LocalStorageKeyEnvironment path to the empty string instead of undefined/null.
- External links are no longer navigated to, even if used in a component. This should not cause
breakage but if it does please open an issue.
- Reference: #111
- PathnameEnvironment usable in non-html5 history api browser; falls back on window.location.pathname.
- See #113. Thanks @spicydonuts
- Fix typo
- Move React & React-async to peerDependencies. Fixes #102
- React 0.12 compatibility.
- Bugfix for regex match keys.
- Allow specifying key names for regex matches.
- Documentation fixes.
- Fixes for nested contextual routers
- Fixed
prefix
in routers nested > 1 level deep. - Matching on
/
inside a contextual router now works as expected.
- Fixed
- Documentation fixes
- Cancel
<Link>
navigation on everything but a vanilla left click (no modifiers).
- IE8 compat fixes
- Added regex support in
<Location>
's path attribute.
- Fixed mismatch in arities when using
navigate()
andsetPath()
.
- Fixed middle-click and ctrl/meta click on components not opening in a new tab.
- Fixed
reactify
devdep in examples. - Fixed crash on null/undefined inside
<Locations>
. You may now use ternary expressions to remove a<Location>
based on a condition.
- Updated to React 0.11.
- Fixed intra-page hash routing (scrolling to anchors).
- Updated
url-pattern
, supports optional patterns.
- IE8 compat fixes
- Made
getParentRouter()
method optional when implementing new routers.
- update react-async dep
- fix IE9 not to use pathnameEnvironment by default (pushState is absent there).
-
breaking change Router now only prefetches async state (via react-async) if and only if current handler's type is different from next handler's type.
This now matches the behaviour of getInitialState which is only called once for each component instance.
If you have your async state dependent on props, you need to initiate async state update in
componentWillReceiveProps(nextProps)
by using values fromnextProps
.
- Add
<CaptureClicks>
component to capture clicks on<a>
-elements and turn them into in-app navigation actions. Thanks to Matthew Dapena-Tretter (@matthewwithanm on GitHub).
-
RouterMixin now delegates state update to setRoutingState method if it's available.
-
AsyncRouteRenderingMixin now provides implementation of setRoutingState store pendingState update in router's state.
-
AsyncRouteRenderingMixin now provides hasPendingUpdate() which returns t if router has active pendingState. This fixes #23.
-
Handler component is now instantiated during state update.
- RouterMixin doesn't specify onNavigation/onBeforeNavigation in getDefaultProps and thus allows to specify them in user code (#22).
- Fix bug with require('./environment') using an invalid case.
-
Bump react-async to 0.8.0.
-
Fixes to environments, now they properly unsubscribe event listeners.
- Update react dep to 0.10.0. Fix few warnings in test suite.
- Expose environment and environment implementations.
-
Contextual routers are only can be in context of other routers if they share the same environment.
-
If contextual routers isn't given an environment (via
hash
orenvironment
prop) then it is default to an environment from parent's router if any.
- Do not set
key
prop on handler, this fixes a bug when the same handler component will make DOM to be resetted with innerHTML which is neither nice nor performant. Also that didn't work with async components.
Link.props.onClick
now can prevent navigation by callingevent.preventDefault()
. Thanks to Matthew Dapena-Tretter (@matthewwithanm on GitHub).
- Add onNavigation and onBeforeNavigation callbacks. Thanks to Dave Mac (@DveMac in GitHub).
- Use envify transform for browserify
- Fix bug with router unregistration.
- Handle Router.navigate(path, {replace: true) and
<Link replace />
by replacing the current history record instead creating a new one.
- Fix recalculating router's state on new props
- Fix hash router to normalize path correctly ('' coerces to '/')
- Custom routers can now have access to per-navigation params via
this.state.navigation
. For example navigation occurred as a result of popstate/hashchange event no hasthis.state.navigate.isPopState
set totrue
.
globalHash
property forLink
to force it to navigate usinghashEnvironment
-
Router component now waits for async components (via react-async) before updating itself
-
remove Hash namespace, use
hash
prop instead:...
-
RouterMixin now doesn't access this.props.children directly but instead gets routes via getRoutes() method
-
rework NavigatableMixin: add getPath(), navigate(path, cb), makeHref(path) methods, remove getRouter() method
-
add AsyncRouteRenderingMixin
-
add RouteRenderingMixin
-
Link components now generate valid href when instantiated inside contextual routers
-
Link components now accept
global
prop to create a link which is forced to operate outside of a local router's context
- factor out RouterMixin for reusability
- expose environment
-
fixes for server side rendering
-
browser test suite refactored to use ReactTestUtils
- Location now passes all props to its handler (except "path" and "handler" which are reserved for Location)
- Link component can now communicate with the router (of the default environment) outside of router context
- do not pollute history with duplicate entries (breaks forward button behaviour)
- fix server side usage
-
update react version to 0.9.0
-
environments are now aggregated (reduced number of event listeners)
-
support for hash routers
-
support for contextual routers
-
Link component for navigation
- support for routers with just a single location
- allow passing handlers via "handler" prop
- fix bug with router re-rendering
- initial release