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

reactotron saga -> support yielded promises #346

Closed
aight8 opened this issue Mar 5, 2017 · 2 comments
Closed

reactotron saga -> support yielded promises #346

aight8 opened this issue Mar 5, 2017 · 2 comments

Comments

@aight8
Copy link

aight8 commented Mar 5, 2017

Currently a returned promise - which is supported by redux-saga correctly - reactotron display "UNKNOWN" as entry.

Example:

// anonymous promise
yield new Promise(r => { r() })

// promise returned by function
function fetchUser() { return new Promise(r => { r() }) }
yield fetchUser()

// promise based class
class FetchSomething extends Promise { /*...*/ }
yield FetchSomething
// FetchSomething.constructor.name == "FetchSomething"
// FetchSomething instanceof Promise == true

I consider how it could be more informative.
First "PROMISE" were better than "UNKNOWN".

Maybe if the Promise contains a "name" prop it could take this one. Then display PROMISE(fetchUser).

if (obj instanceof Promise) {
  let display: string; 
  if (x.name) { // a promise object with a manually set name prop for display reasons
     display = `PROMISE(${x.name})`
  } else if (x.constructor instanceof Promise.constructor) { // an anonym promise
     display = 'PROMISE'
  } else { // class which extends Promise, so output the name of the class to precise
     display = `PROMISE(${obj.constructor.name;})`
  }
}
@skellock
Copy link
Contributor

skellock commented Mar 5, 2017

Thanks. I've never tried to do that before.

@skellock
Copy link
Contributor

Thx man. This will be in for the next release shortly.

joshuayoes pushed a commit that referenced this issue Jan 17, 2023
Co-authored-by: Renovate Bot <bot@renovateapp.com>
joshuayoes pushed a commit that referenced this issue Jan 27, 2023
Co-authored-by: Renovate Bot <bot@renovateapp.com>
joshuayoes pushed a commit that referenced this issue Jan 30, 2023
Co-authored-by: Renovate Bot <bot@renovateapp.com>
joshuayoes pushed a commit that referenced this issue Feb 1, 2023
Co-authored-by: Renovate Bot <bot@renovateapp.com>
silasjmatson pushed a commit that referenced this issue Mar 14, 2023
Co-authored-by: Renovate Bot <bot@renovateapp.com>
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

2 participants