Releases: FormidableLabs/redux-little-router
And We Back (with Type Fixes)!
This release introduces two fixes to our TypeScript definitions.
Changes:
Fix All the Things and All the Types
This release introduces several updates to our TypeScript and FlowTyped definitions. TypeScript users should update their package.json
to v15.1.1
.
Changes:
- Merged #280
Update index.d.ts
by @opavader - Merged #281
Replace {} with any
by @NeoLegends - Merged #282
Made optional arguments for browser router optional in flow type
by @gertsonderby, which fixed #268
You Want (TypeScript) Types, You Got 'Em
This release adds TypeScript definitions that ship directly with the library.
Changes:
- Add
index.d.ts
at the root level of the repository. - Nuke
package-lock.json
and insist onyarn
. - Add CONTRIBUTING section to
README.md
.
Shake Your Money Maker
This release moves immutable
wrappers to a separate re-export index and adds support for better webpack4+ tree shaking.
Changes:
- BREAKING CHANGE: Move
immutable*
re-exports fromindex.js
toimmutable/index.js
compatibility #267 - Add
package.json:sideEffects: false
so webpack4+ can tree shake ESM much better.
Never Change
This release brings immutable
support, Flow types, navigation confirmation, es
builds, and more!
Implemented enhancements:
- Immutablejs compatibility #77
- Add navigation confirmation/blocking API #258 (tptee)
- Provide flow types + a little housekeeping #257 (tptee)
- Add immutable example to README #250 (stefvhuynh)
- immutable support #248 (stefvhuynh)
- Es output #247 (stefvhuynh)
- Support React v16 #235
Fixed bugs:
Ima fix `Fragment`
This release focuses on improving Fragment
. We fixed a bunch of rendering bugs, removed <RouterProvider>
, and added 404 fragments!
Breaking
- Remove
<RouterProvider>
.bff8788
- The middleware now emits navigation events like
PUSH
andREPLACE
in addition toLOCATION_CHANGED
. You should still depend onLOCATION_CHANGED
to know when the navigation actually happens.
Added
- Added "404" routes with a
forNoMatch
prop onFragment
- Swap in builder with more concurrency + other tweaks. Thanks @ryan-roemer !
36d38d0
- Add hash router (#173) (thanks @Stuk !) (resolved #102)
- We use Prettier now!
Fixed
Breaking Changes Are Hard to Do
Breaking
- The library no longer enhances the reducer. Instead, a factory function returns the prepared middleware, enhancer, and reducer. This is to allow for easier compatibility with special reducer types in the ecosystem (e.g.
immutable
andredux-loop
). See the new instructions for setting up the Redux boilerplate. - Removed
<AbsoluteFragment>
and made<RelativeFragment>
the default export for<Fragment>
. <Fragment>
no longer wraps children in an extraneous<div>
. This requires<Fragment>
to accept only single children.
Minor
- Added action creators for navigation to the official API. Resolves #99.
- Flow definitions enhanced for accuracy.
Patch
Don't Worry, Be Hapi
Revenge of the Middleware
Better store enhancer APIs
We've overhauled the store enhancer API to require less fiddly and error-prone configuration!
On the browser:
// Install the router into the store for a browser-only environment
const clientOnlyStore = createStore(
yourReducer,
initialState,
routerForBrowser({
// The configured routes. Required.
routes,
// The basename for all routes. Optional.
basename: '/example'
})
);
For an Express route:
app.use('/*', (req, res) => {
// Create the Redux store, passing in the
// Express request to the store enhancer.
//
// If you're using an Express sub-router,
// routerForExpress will infer the basename
// from req.baseUrl!
const store = createStore(
state => state,
{ what: 'ever' },
routerForExpress({
routes,
request: req
})
);
// ...then renderToString() your components as usual,
// passing your new store to your <Provider> component.
//
// Don't forget to attach your ESCAPED initialState to
// a script tag in your template that attaches to
// something like window.__INITIAL_STATE.
});
Major
New browser and Express store enhancer APIs with updated docs (#73)