Meteor 2.8 async with React (react-meteor-data withTracker hook)

Hello,

I use the following flow, which is based on a FlowRouter and a container and a component

Router.js

const {Router, Header, Layout, LocalState, namespace} = context;
  const HeaderCTX = injectDeps(Header);

  Router.route('/test', {
    name: 'Test',
    fastRender: false,
    waitOn() {
      return [
        Meteor.subscribe('Companies.getMyCompany'),
        Meteor.subscribe('Integrations.getCompanyIntegrations')
      ];
    },
    action() {
      LocalState.set('selectedItem', 'test');
      const accessRoles = [ 'ADMINISTRATOR' ];
      mountOnb(HeaderCTX, {
        content: () => {
          return <Layout accessRoles={accessRoles} LocalState={LocalState} namespace={namespace}><Dashboard context={context}/></Layout>;
        },
        header: {title: 'menu.settings', description: ''}
      });
    }
  });

container.js

import { Meteor } from 'meteor/meteor';
import { withTracker } from 'meteor/react-meteor-data';

import Dashboard from '../components/dashboard.jsx';
import {Integrations} from '/lib/collections';
// import {Orders} from '/lib/collections';

const DashboardWT = withTracker(async ({context}) => {

  const integrationArray = await Integrations.find({companyId: Meteor.user().companyId}).fetchAsync();
  return {
    integrationArray
  };

})(Dashboard);

export default DashboardWT;

and component.jsx

import _ from 'underscore';

import React, { useState, useEffect } from 'react';
import { Container, Row, Col } from 'react-grid-system';

export default function Dashboard(props) {

  let inteObj = [];
  _.each(props.integrationArray, integration => {
    inteObj.push(<div>{integration._id}</div>);
  });


  return (
    <>
      <Row className='mb-5'>
        <Col>
          <h3>Test component</h3>
        </Col>
      </Row>
    </>
  );
}

Unfortunately, I donā€™t know how in this case to ensure that the content is rendered until the await in the containerā€¦ Isnā€™t it necessary to modify withTracker?

Thank you for help

This is expected on Meteor 2.11

Ongoing discussion:

1 Like

Thank you @rjdavid for info