Skip to content

Commit 6aff30a

Browse files
authored
Merge pull request #1 from edtoken/pre-release
v0.1.3
2 parents 07130bc + 7c8cb03 commit 6aff30a

File tree

20 files changed

+742
-593
lines changed

20 files changed

+742
-593
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ node_js:
55
- "7"
66
- "6"
77

8-
after_script:
8+
before_script:
99
- "npm run test:cov"
1010
- "npm install coveralls && cat ./coverage/lcov.info | coveralls"

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
# 0.1.3
4+
Fix critical bug in method `Action.empty`
5+
small refactoring action.js, selector.js files
6+
Write new tests
7+
Update documentation
8+
39
## 0.1.2
410
Write new tests (increase coverage)
511
Add selector `getMergedActionsData`, for details please see [source](https://github.com/edtoken/redux-tide/blob/master/src/selector.js#L116) and [example](https://edtoken.github.io/redux-tide/?ex=merged-actions-data) and [example-source](https://github.com/edtoken/redux-tide/blob/master/website/src/merged-actions-data/index.js#L50)

README.md

Lines changed: 14 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,14 @@ You don't need to create reducers for rest-api data
2323
You should create reducers only for business front-end logic
2424

2525
## Examples
26-
*Please, look how to work blog and different-entity-id-example, abd merged-actions-data*
26+
*Please, look how to work this examples
2727
[blog](https://edtoken.github.io/redux-tide/?ex=blog) - using with axios and REST api
2828
[blog-source](https://github.com/edtoken/redux-tide/tree/master/website/src/blog) - blog demo source code
2929
[different-entity-id-example](https://edtoken.github.io/redux-tide?ex=different-entity-id)
3030
[different-entity-id-source](https://github.com/edtoken/redux-tide/tree/master/website/src/different-entity-id)
3131
[merged-actions-data-example](https://edtoken.github.io/redux-tide?ex=merged-actions-data)
3232
[merged-actions-data-source](https://github.com/edtoken/redux-tide/tree/master/website/src/merged-actions-data)
3333

34-
[counter (soon)](https://edtoken.github.io/redux-tide/?ex=counter)
35-
[todos (soon)](https://edtoken.github.io/redux-tide/?ex=todos)
3634
[video](https://cl.ly/3d183v352O24) - short video for demonstration
3735

3836
## Installation
@@ -176,6 +174,17 @@ export const openEditPost = (postId) => {
176174

177175
```
178176

177+
## How to reset action store data?
178+
When you need to force a clear state of action, please use
179+
180+
```javascript
181+
dispatch(createNewPost.empty())
182+
```
183+
OR
184+
```javascript
185+
dispatch(getPostById.withPrefix(props.postId))
186+
```
187+
179188
## How to use with array of connected components ?
180189
Please read **Create one action for different entity id** section
181190
And look examples:
@@ -537,95 +546,10 @@ export const getAllPosts = createAction(
537546
// getAllPosts.withName(yourCustomName)
538547
// getAllPosts.empty()
539548

540-
541-
/**
542-
*
543-
* @type {Function}
544-
* @returns {Function} - returns action id
545-
*/
546-
Action.type = Action.actionId = Action.toString = Action.valueOf = () => {
547-
return actionId
548-
}
549-
550-
/**
551-
*
552-
* @param {Object} item - source entity data
553-
*
554-
* @type {Function}
555-
* @returns {Function} - returns id from source
556-
*/
557-
Action.getEntityId = item => {
558-
return actionSchema.getId(item)
559-
}
560-
561-
/**
562-
*
563-
* @type {Function}
564-
* @returns {Object} - returns actionSchema of action
565-
*/
566-
Action.getSchema = () => {
567-
return actionSchema
568-
}
569-
570-
/**
571-
*
572-
* @type {Function}
573-
* @returns {Function} - returns entity uniq name (id)
574-
*/
575-
Action.getEntityName = () => {
576-
return actionSchema.key
577-
}
578-
579-
/**
580-
*
581-
* @type {Function}
582-
* @returns {Action} - returns some action with new uniq id
583-
*/
584-
Action.clone = () => {
585-
return createAction(
586-
actionSchema,
587-
actionMethod,
588-
queryBuilder,
589-
responseMapper
590-
)
591-
}
592-
593-
/**
594-
*
595-
* @type {Function}
596-
* @returns {Action} - returns some action with prefix-id
597-
*/
598-
Action.withPrefix = (...prefix) => {
599-
return _makeWithId(prefix.join('-'))
600-
}
601-
602-
/**
603-
*
604-
* @type {Function}
605-
* @returns {Action} - returns some action with name-id (see prefix)
606-
*/
607-
Action.withName = name => {
608-
return _makeWithId(name)
609-
}
610-
611-
/**
612-
* Clear action store data
613-
*
614-
* @memberOf action._makeAction.Action
615-
* @type {Function}
616-
*
617-
* @example
618-
* store.dispatch(userLoginAction.empty())
619-
*
620-
* @returns {Undefined} - returns None, only clear action data
621-
*/
622-
Action.empty = () => {
623-
return (dispatch, getState) => {
624-
// ...
625-
}
626-
}
627549
```
628550
551+
For details, please look [source](https://github.com/edtoken/redux-tide/blob/master/src/action.js#L348)
552+
629553
## Contributions
630554
Use [GitHub issues](https://github.com/edtoken/redux-tide/issues) for requests.
631555
I actively welcome pull requests; learn how to contribute.

0 commit comments

Comments
 (0)