Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createAction not accepting null as second argument #169

Closed
Bouncey opened this issue Nov 22, 2016 · 7 comments
Closed

createAction not accepting null as second argument #169

Bouncey opened this issue Nov 22, 2016 · 7 comments

Comments

@Bouncey
Copy link

Bouncey commented Nov 22, 2016

I have just tried to v1.0.1 and I am getting this error stack.

Throws this error stack

Failed loading boot script: /home/stuart/freecodecamp/server/boot/react.js
Invariant Violation: Expected payloadCreator to be a function or undefined
    at invariant (/home/stuart/freecodecamp/node_modules/invariant/invariant.js:42:15)
    at createAction (/home/stuart/freecodecamp/node_modules/redux-actions/lib/createAction.js:30:27)
    at Object.<anonymous> (/home/stuart/freecodecamp/common/app/redux/actions.js:24:27)
    at Module._compile (module.js:570:32)
    at loader (/home/stuart/freecodecamp/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/home/stuart/freecodecamp/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Function._load (/home/stuart/freecodecamp/node_modules/pmx/lib/transaction.js:62:21)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/stuart/freecodecamp/common/app/routes/challenges/components/map/Challenge.jsx:12:1)
    at Module._compile (module.js:570:32)
    at loader (/home/stuart/freecodecamp/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .jsx] (/home/stuart/freecodecamp/node_modules/babel-register/lib/node.js:154:7)
Invariant Violation: Expected payloadCreator to be a function or undefined
    at invariant (/home/stuart/freecodecamp/node_modules/invariant/invariant.js:42:15)
    at createAction (/home/stuart/freecodecamp/node_modules/redux-actions/lib/createAction.js:30:27)
    at Object.<anonymous> (/home/stuart/freecodecamp/common/app/redux/actions.js:24:27)
    at Module._compile (module.js:570:32)
    at loader (/home/stuart/freecodecamp/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/home/stuart/freecodecamp/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Function._load (/home/stuart/freecodecamp/node_modules/pmx/lib/transaction.js:62:21)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/stuart/freecodecamp/common/app/routes/challenges/components/map/Challenge.jsx:12:1)
    at Module._compile (module.js:570:32)
    at loader (/home/stuart/freecodecamp/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .jsx] (/home/stuart/freecodecamp/node_modules/babel-register/lib/node.js:154:7)

The actions causing the error are in this format

export const toggleMapDrawer = createAction(
  types.toggleMapDrawer,
  null,
  () => createEventMeta({
    category: 'Nav',
    action: 'toggled',
    label: 'Map drawer toggled'
  })
);

Any advice would be greatly appreciated

@yangmillstheory
Copy link
Contributor

yangmillstheory commented Nov 22, 2016

Invariant Violation: Expected payloadCreator to be a function or undefined

Could you pass undefined instead of null? After a long discussion, we decided not to have null and undefined mean the same things in this context.

@Bouncey
Copy link
Author

Bouncey commented Nov 22, 2016

Our linting is against undefined, I will discuss with our other maintainers 👍

@yangmillstheory
Copy link
Contributor

yangmillstheory commented Nov 22, 2016

@Bouncey Let me discuss this with @timche (unfortunately it's past midnight in Germany, where he's located). I had some reservations merging this constraint, and I don't think it should inconvenience your team this much. I'd like to allow null again.

Can you downgrade for now?

@Bouncey
Copy link
Author

Bouncey commented Nov 22, 2016

I was just testing out the greenkeeper PR, it isn't merged just yet

@yangmillstheory
Copy link
Contributor

v1.1.0 is out, and supports null payload creators once again.

@Bouncey
Copy link
Author

Bouncey commented Nov 23, 2016

Thanks for the quick turn around 👍

@BerkeleyTrue
Copy link

BerkeleyTrue commented Nov 28, 2016

@Bouncey Thanks for pointing this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants