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

dispatch interface returns pending promise instead of resolved #1668

Closed
vicglarson opened this issue Jan 24, 2020 · 5 comments
Closed

dispatch interface returns pending promise instead of resolved #1668

vicglarson opened this issue Jan 24, 2020 · 5 comments

Comments

@vicglarson
Copy link

Version

3.1.2

Reproduction link

https://jsfiddle.net/jtzqmxk3/

Steps to reproduce

in this request insterface of dispatch changed
Look at this https://github.com/vuejs/vuex/pull/1115/files#diff-3bf35cd41da51153dcca3003656f7c67R139

it returns now pending promise for returned true from action instead of resolved. You can see it at jsfiddle console.

What is expected?

untouched Promise.resolve(true) returned by action wrapper
when no any action subscribers added

What is actually happening?

returned pending promise


also you can look at
#1572
which targets the same pull request

Perhaps I have bad assumptions. But behavior for trivial action response is not specified here https://vuex.vuejs.org/ru/guide/actions.html

@LinusBorg
Copy link
Member

LinusBorg commented Jan 24, 2020

it returns now pending promise for returned true from action instead of resolved. You can see it at jsfiddle console.

I get a fullfilled promise, see the screenshot:

grafik

Also the fiddle seems to do w´hat its meant to do generally. I might have problems following your problem description though.

@vicglarson
Copy link
Author

image
not sure fiddle depends on browser but in opera i see this

@ktsn
Copy link
Member

ktsn commented Jan 25, 2020

As you synchronously log the Promise object, it is in pending state at that moment. It will be fulfilled immediately on the next tick. I'm not sure what is the problem on this behavior.

@LinusBorg
Copy link
Member

Works in Opera 66.035 (Mac) as well:

image

@vicglarson
Copy link
Author

@ktsn yep it's fulfilled on next tick so i think i'm wrong

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