-
-
Notifications
You must be signed in to change notification settings - Fork 192
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
Cannot assign other store action to property #796
Comments
Hi @IgorTakacs ! You are assigning a function to your model Is there any perticular reason you want to have a function as state? What are you trying to achieve? Maybe there could be another solution to your problem.
Instead of assigning the action to state, you could resolve the action from another model within the someThunk: thunk((actions, payload, { getStoreActions }) => {
/**
* Some code
*/
const { someAction } = getStoreActions().randomModel;
someAction();
/**
* Rest of code
*/
}), Another way, would be to either register a |
@jmyrland Thank you for your answer! What I have found funny is, that the approach above worked when I was passing a function that wasn't a store action. The functionality I was trying to achieve, is related to a "delete - undo delete" feature.
The above also needs to be somewhat reusable, because I'm dealing with a variety of different types of items... (all with different actions, parameters and endpoints)
Nevertheless, I was trying to avoid having to need to switch the whole paradigm, because that would require extra work on the project, but guess that's what I'll be doing. Thank you once again for the clarification! |
Ah, I see. This library might help you https://github.com/mighdoll/undo-peasy |
closing as resolved |
Hi all,
My problem is the following:
When executing the above, I get the error:
Error in @thunk.randomModel.someAction(start)
[TypeError: Cannot read property 'reportError' of undefined]
Note: someFunction that we get is another store action that has parameters.
i.e.:
Note: If I were to call the
someFunction
likesomeFunction()
, right in the store where I'm setting it topropertyA
, everything would work.Anyone know how to fix this?
Thank you in advance!
Best wishes
The text was updated successfully, but these errors were encountered: