question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

createAction not accepting null as second argument

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7

github_iconTop GitHub Comments

5reactions
yangmillstheorycommented, Nov 23, 2016

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

0reactions
BerkeleyTruecommented, Nov 28, 2016

@Bouncey Thanks for pointing this out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redux Toolkit: How to refer action created with createAction ...
To have a saga listen to the action. Saga Effects accept string type of an action to react. Luckily, actionCreators expose a type...
Read more >
createAction - Redux Toolkit
To do this, createAction accepts an optional second argument: a "prepare callback" that will be used to construct the payload value.
Read more >
ArgumentException Class (System) - Microsoft Learn
ArgumentNullException whenever null is passed to a method that does not accept it as a valid argument. ArgumentOutOfRangeException when the value of an ......
Read more >
Chapter 11 Creating Actions and Data Types Using Create ...
If the application requires a non-file argument, you cannot use Create Action to create the action. The types of data files an application...
Read more >
Different Ways to Dispatch Actions with Redux - Pluralsight
The second argument to connect is the function mapDispatchToProps, ... The above implies that we do not need to dispatch our actions.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found