You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I call the method addFavorite() internally I call the method this.getAll() and assign its result to favorites.
The problem is that favorites.push(id) seems to be executed before the method this.getAll() returns, like if it was async, and I get an error of course because favorites is undefined.
I don't know if the problem here is about something related to es6 which I'm a total noob at.
The text was updated successfully, but these errors were encountered:
@vesparny Oh, actually I see the problem now. All actions return undefined (or a promise that resolves to undefined) to their caller. This is by design, to enforce unidirectional data flow. Data fetching operations like getAll() should be in a separate class or module. Usually you'd call this something like WebAPIUtils. There's a section about this in the API docs for Actions: https://github.com/acdlite/flummox/blob/master/docs/api/Actions.md
I have this Action
When I call the method
addFavorite()
internally I call the methodthis.getAll()
and assign its result tofavorites
.The problem is that
favorites.push(id)
seems to be executed before the methodthis.getAll()
returns, like if it was async, and I get an error of course because favorites is undefined.I don't know if the problem here is about something related to es6 which I'm a total noob at.
The text was updated successfully, but these errors were encountered: