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.

Non-FSA actions cause handleAction reudcers to emit confusing error messages

See original GitHub issue

In #141 an invariant checks that each action is an FSA before attempting to process it. When attempting to upgrade to 1.0.0, this causes issues in a large app I am working on where our more recent actions follow the FSA pattern, but older actions do not. When those older actions were triggered, the invariant caught them and prevented the reducers that are actually intended to process that type of action from receiving it.

This is at odds with allowing larger apps to migrate incrementally; we need to update all of our actions / reducers to upgrade.

Further, the error message generated by #141 was actually misleading; the actions had a type attribute, which is a stronger redux convention than FSA, but had attributes that aren’t on the FSA whitelist (https://github.com/acdlite/flux-standard-action/blob/master/src/index.js).

It seems like there are a couple decisions to be made:

  1. Should using this package require that all of your actions be FSA?
  2. Should using this package require that all of your actions have a type?

If the answer to (1) is “yes”, then we can close this issue (although we should probably document this in the README).

If the answer to (1) is “no”, then I can use an answer to (2) to write a PR. Let me know what y’all think.

IMO, reducers created by handleAction should only complain if an action is emitted with a type that they are listening for that is not an FSA. That opinion seems to be at odds with this request, which makes it sound like someone encountered an incident where they were emitting an action without a type that was hard to diagnose. In that scenario, it seems like the action wasn’t created via createAction, and so I sort of expect that onus to fall on the developer (although I could certainly be convinced that there are better options available).

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
timchecommented, Nov 19, 2016

With v1.0.0 we are trying to make this library more user-friendly with throwing errors if something is wrong, so debugging is much easier.

This library is primarily designed for Flux Standard Actions since the beginning, so it should only work with FSA:

An action MUST

  • be a plain JavaScript object.
  • have a type property.
0reactions
timchecommented, Nov 21, 2016

We have published v1.0.1. Let us know if you still have any issues, thanks 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing execution_count causes confusing error messages
There are actually a few causes: If a code cell does not have the "execution_count" property in its metadata; if a markdown cell...
Read more >
Redux: Displaying Error Messages | egghead.io
We will learn how to handle an error inside an async action, display its message in the user interface, and offer user an...
Read more >
Centralized Error Handing with React and Redux | Pluralsight
Displaying Errors​​ The action of the component it simple: it shows a message if there's an error in the error store, and it...
Read more >
Error Messages: Examples, Best Practices & Common Mistakes
4 common mistakes with error messages · 1. Ambiguity · 2. Condescending language/blaming the user · 3. Poor placement of error messages ·...
Read more >
Writing Helpful Error Messages | Technical Writing
While this course contains lessons for many error message scenarios, ... imprecise; confusing; inaccurate; unclear cause; unknown next steps.
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