Skip to content

Commit

Permalink
feat(getPersistableState): allow persistence via redux-persist (#37)
Browse files Browse the repository at this point in the history
* All done except invalidate cacheLifetime === Infinity

* added expireAt, tests need fixing

* update snaps

* hasCacheExpired tests done

* tests OK

* feature done, needs tests

* empty paths OK

* requests tests OK

* resources tests OK

* tests done

* docs done

* fixed typos in docs
  • Loading branch information
adrienharnay authored and Titozzz committed Mar 20, 2018
1 parent 3466b24 commit 57c243f
Show file tree
Hide file tree
Showing 31 changed files with 1,116 additions and 323 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ To solve the problems listed above, `redux-rest-easy` **generates actions, reduc

It also provides **sensible defaults**, allowing you to use it with **almost no configuration**, but also to **customize** anything you would like.

And the cherry on the top: it works seamlessly with [redux-offline](https://github.com/redux-offline/redux-offline) and [redux-persist](https://github.com/rt2zz/redux-persist)!

[Scroll down](#minimal-example) for a small example, or [browse the documentation](#api) to get started! To learn more about the problem and solution, you can also read the [release article][release-article].

## API
Expand All @@ -61,6 +63,7 @@ import {
* [connect](./docs/api/connect.md) - connect your components to the state so the magic can happen
* [reset](./docs/api/reset.md) - reset `redux-rest-easy`'s whole state (you can reset parts of the state with actions generated by `createResource`)
* [initializeNetworkHelpers](./docs/api/initializeNetworkHelpers.md) - provide your own network handlers (optional, fallback to included defaults)
* [getPersistableState](./docs/api/getPersistableState.md) - transform the state before storing it, in order to later persist it (using [redux-offline](https://github.com/redux-offline/redux-offline), [redux-persist](https://github.com/rt2zz/redux-persist), or friends)

## Internals

Expand All @@ -70,10 +73,10 @@ import {

## Core principles

1. [Preflight checks](./docs/principles/preflight.md)
2. [Actions](./docs/principles/actions.md)
3. [Reducers](./docs/principles/reducers.md)
4. [Selectors](./docs/principles/selectors.md)
1. [Preflight checks](./docs/principles/preflight.md)
2. [Actions](./docs/principles/actions.md)
3. [Reducers](./docs/principles/reducers.md)
4. [Selectors](./docs/principles/selectors.md)

## Minimal Example

Expand All @@ -86,7 +89,7 @@ const users = createResource('users')({
retrieve: {
method: 'GET',
url: 'https://my-api.com/users',
afterHook: () => console.log('Users retrieved successfuly'),
afterHook: () => console.log('Users retrieved successfully'),
},
});

Expand Down Expand Up @@ -178,9 +181,11 @@ Redux-rest-easy also uses [redux-thunk][redux-thunk] to handle async actions, an
Thanks goes to these people ([emoji key][emojis]):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->

<!-- prettier-ignore -->
| [<img src="https://avatars1.githubusercontent.com/u/15089053?v=4" width="100px;"/><br /><sub><b>Adrien HARNAY</b></sub>](https://adrien.harnay.me)<br />[📝](#blog-Zephir77167 "Blogposts") [💻](https://github.com/Brigad/redux-rest-easy/commits?author=Zephir77167 "Code") [📖](https://github.com/Brigad/redux-rest-easy/commits?author=Zephir77167 "Documentation") [🤔](#ideas-Zephir77167 "Ideas, Planning, & Feedback") [🚇](#infra-Zephir77167 "Infrastructure (Hosting, Build-Tools, etc)") [👀](#review-Zephir77167 "Reviewed Pull Requests") [⚠️](https://github.com/Brigad/redux-rest-easy/commits?author=Zephir77167 "Tests") | [<img src="https://avatars1.githubusercontent.com/u/6181446?v=4" width="100px;"/><br /><sub><b>Thibault Malbranche</b></sub>](https://github.com/Titozzz)<br />[🐛](https://github.com/Brigad/redux-rest-easy/issues?q=author%3ATitozzz "Bug reports") [💻](https://github.com/Brigad/redux-rest-easy/commits?author=Titozzz "Code") [🤔](#ideas-Titozzz "Ideas, Planning, & Feedback") [👀](#review-Titozzz "Reviewed Pull Requests") | [<img src="https://avatars3.githubusercontent.com/u/11462388?v=4" width="100px;"/><br /><sub><b>Grisha Ghukasyan</b></sub>](https://github.com/eole1712)<br />[🤔](#ideas-eole1712 "Ideas, Planning, & Feedback") | [<img src="https://avatars1.githubusercontent.com/u/569243?v=4" width="100px;"/><br /><sub><b>Aymeric Beaumet</b></sub>](https://aymericbeaumet.com)<br />[🤔](#ideas-aymericbeaumet "Ideas, Planning, & Feedback") | [<img src="https://avatars3.githubusercontent.com/u/3433722?v=4" width="100px;"/><br /><sub><b>Jess</b></sub>](https://github.com/Pinesy)<br />[🐛](https://github.com/Brigad/redux-rest-easy/issues?q=author%3APinesy "Bug reports") [📖](https://github.com/Brigad/redux-rest-easy/commits?author=Pinesy "Documentation") |
| :---: | :---: | :---: | :---: | :---: |

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors][all-contributors] specification.
Expand Down
Loading

0 comments on commit 57c243f

Please sign in to comment.