Mantra module doesn't get actions


#1

I have a module which seems to be defined right, but for some reason it doesn’t get actions. Props for actions are undefined. I’ve checked - actions are defined and well if I log them from module’s index.js but after that, they’re undefined in the container’s depsMapper, it gets an empty object instead of object filled with actions. What could be the reason? What should I check?

myModule/actions/myActions.js:

export default { update({Meteor}) { // implementation }, }

myModule/actions/index.js:

`import myActions from ‘./myActions’;

const actions = {
myActions
};

export default actions;`

myModule/containers/myContainer.js:

`import {useDeps, composeWithTracker, composeAll} from ‘mantra-core’;
import Component from ‘…/components/myComponent’;

export const composer = ({context}, onData) => {
const {Meteor, LocalState} = context();
const user = Meteor.user();
// implementation
};

export const depsMapper = (context, actions) => ({
action1: actions.profile.action1,
action2: actions.profile.action2,
context: () => context
});
};

export default composeAll(
composeWithTracker(composer),
useDeps(depsMapper)
)(Component);`


#3

Why? So far I’ve seen that it’s done with an anonymous object, like here: https://themeteorchef.com/snippets/working-with-the-mantra-architecture/#tmc-writing-actions

moreover, I have other modules with ctions defined like this that work fine


#4

Did you loadModule() ?


#5

have you read the complete version here? https://kadirahq.github.io/mantra/