Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 23, 2020. It is now read-only.

Commit841a61a

Browse files
author
Vince Speelman
committed
fix(creators): don't invoke promises. duh
I mistakenly evaluated promises in place upon generation. Instead, I'm now naievely assuming that ifyou return a function, you might need async actions. If you don't, no problem.
1 parent2de67ef commit841a61a

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

‎src/index.js‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
import{createActionsasact}from'redux-actions';
22

33
constSTATES=['REQUESTED','RECEIVED','REJECTED'];
4-
constisPromise=value=>{
5-
lettest=value;
6-
if(typeofvalue==='function'){
7-
test=value();
8-
}
9-
returnPromise.resolve(test)===test;
10-
};
4+
constisPromise=value=>Promise.resolve(value)===value;
115

126
constcreateActions=(
137
{ states=STATES, prefix=''}={
@@ -20,8 +14,7 @@ const createActions = (
2014
(acc,[k,v])=>({
2115
...acc,
2216
[k]:isPromise(v) ?()=>v :v,
23-
...(v&&
24-
isPromise(v)&&
17+
...(((v&&isPromise(v))||typeofv==='function')&&
2518
states.reduce(
2619
(acc,curr)=>({
2720
...acc,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp