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.

RFC: Action/Thunks listeners

See original GitHub issue

Hey all;

The previous RFC process I opened for the computed property was extremely useful - I received a lot of quality feedback which helped guide me to the best API. Therefore I’d like to use the same process for an adjusted action/thunk listener API.

The current action/thunk listeners API (configured via the listenTo config) has a few shortcomings, namely:

  • Error payloads are not exposed when listening to failed thunk events
  • If you are listening to multiple actions there is no way to distinguish which action is being responded to.
  • The mechanism by which we listen to specific stages of a thunk does not feel as fluid as the rest of the API
  • Can’t listen to a “finally” stage of thunks (i.e. failed or successful)

A lot of these concerns have been raised very helpfully by @allpro - which is highly appreciated.

Prior to us going to v3 (with an opportunity to introduce some small breaking changes), I definitely would like us to address these shortcomings. Either enhancing the existing API, or providing an alternative richer one.

Related #233 #244 #237

I am going to be laying out a few proposals based on some experiments I have made, taking into account the above related issues.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:24 (21 by maintainers)

github_iconTop GitHub Comments

2reactions
jamaljsrcommented, Jul 9, 2019

Looks solid to me! 👍

A couple typos I see:

The second first argument you provide to a listener definition is the targetResolver function. This function will receive the following arguments:

The targetTypes resolvedTargets array contains the list of the action types resolved by the targetResolver function you provided to the listener. This array will match the index order of the types resolved by the targetResolver.

1reaction
allprocommented, Jul 10, 2019

🎉 Great work Sean. It’s damn hard to fit so many features into a simple, intuitive API.

I hope to soon start training 25 developers, in 3 countries, to use Easy-Peasy, and phase-out Saga. So it’s great news that the API is stabilizing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RFC 793: Transmission Control Protocol
RFC : 793 TRANSMISSION CONTROL PROTOCOL DARPA INTERNET PROGRAM PROTOCOL ... RFC: 793 Replaces: RFC 761 IENs: 129, 124, 112, 81, 55, 44,...
Read more >
Vegetarian friendly state for React - BestofReactjs
RFC : Action/Thunks listeners. Hey all;. The previous RFC process I opened for the computed property was extremely useful - I received a...
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