Problem with Route and Alert message


#1

Hi,

I use a mantra architecture for my application.

For verify user’s email I have a route (FlowRouter) to handle this url.

When Meteor validate the mail, I want to redirect to the home page of my website and show an Alert message (with https://github.com/juliancwirko/react-s-alert).

So for this I use the LocalState (ReactiveDict) to put this information.

In the container of the home page, I put an Alert :

import {useDeps, composeAll, composeWithTracker, compose} from 'mantra-core';

import BoardLayout from '../components/board_layout.jsx';

import Alert from 'react-s-alert';

export const composer = ({context}, onData) => {
  const {Meteor, Collections, LocalState} = context();
  // Don't use Localstate for this example
  Alert.success('Some message',{onRouteClose: false, timeout: 10000});

  if(Meteor.user()){
    const profileImg = Meteor.user().profile.profileImg;
    onData(null, {profileImg});
  }
  else{
    onData(null, {});
  }
};

export const depsMapper = (context, actions) => ({
  context: () => context
});

export default composeAll(
  composeWithTracker(composer),
  useDeps(depsMapper)
)(BoardLayout);

And when I go to this container (FlowRouter.go(’/’)), the page is loaded but no message was rendered.

But, if I reload the page (so without a redirection in the code) the Alert is showing.

So I don’t know with Alert show on direct page loading but not when I redirect with flowrouter.

Thanks.