import { Tracker } from 'meteor/tracker';

const getTrackerLoader = reactiveMapper => (
  (props, onData, env) => {
    let trackerCleanup = null;

    const handler = Tracker.nonreactive(() =>
      Tracker.autorun(() => {
        trackerCleanup = reactiveMapper(props, onData, env);
      }),
    );

    return () => {
      if (typeof trackerCleanup === 'function') trackerCleanup();
      return handler.stop();
    };
  }
);

export default getTrackerLoader;


@@ -286,17 +286,16 @@
       %7D)
-,
 %0A    );%0A
@@ -457,9 +457,8 @@
 Loader;%0A
-%0A

Clean code