[4.5.0] this.$f7ready() - f7 really completely initialized?!

I have the following React Code:

class App extends React.Component {
  constructor() {
    super();
    moment.locale('de');
    this.identifiedUserEMail = null;
  }
  componentDidMount() {
    this.$f7ready((f7) => {
      cordovaApp.init(f7);
      // BROKEN IN 4.5.0
      // Meteor.mainRouter = f7.views && f7.views.main && f7.views.main.router;
    });
  }
  render() {
    const { currentUser, loggingIn, authenticated, redirectNewApp } = this.props;
    let initUrl = "/dashboard";
    if(!loggingIn && !authenticated) initUrl = "/login";
    if(redirectNewApp == true) initUrl = "/update-app";
    return (
      <MainProvider>
        <F7App params={f7params} {...this.props}>
          <Statusbar />
          <View init main url={initUrl} className="is-mobile" iosSwipeBack={true} {...this.props} />
        </F7App>
      </MainProvider>
    )
  }
}

My this.$f7ready() cb used to work in v4.3.1, but is broken in v4.5.0. f7.views.main.router is undefined here. Any help for this?

Just created new F7-React project with F7 CLI and can’t see such issue. All works correctly

1 Like

Hmm … can you find anything else which would be wrong with my code? The <App/> component I posted is my main component which gets rendered. This in turn renders, as you can see, a Context.Provider with the main <F7App/> framework7-component. Could this be a problem? I assure you that the code worked before the update but for some reason the this.$f7ready cb fires too soon - after the first render f7.views.main.router works just fine and is not undefined any more.

What is in the props you pass there and why do you pass same props to App and View?

1 Like

It is my self-built “store” (based on React context) and some information about the loggedin User (if one is logged in) - that is pretty much it. Can’t really see why this would be a problem with the ready() function?!

Try to remove context provider and see if the issue still persist

1 Like

You are correct - removing my <MainProvider> solves the problem. Any idea why this is suddenly a problem in the new version? I need this context provider in my app, without it my app is missing an essential part.

@Twisterking It’s not feasible to do custom debug on your application on this forum.

Best thing to do: make “minimal reproducible example” github repo (tear out everything except this issue with context provider) & post the link here & folks might be able to take a look