okgrow / accounts-ui-react

UNMAINTAINED! - The Meteor accounts-ui we know and love, wrapped in React.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Breaks with react-komposer 2.0.0

martinhbramwell opened this issue · comments

react-komposer no longer exports composeWithTracker

This code supplies a plugin replacement :
TobyEalden / react-komposer README

Sweet find @martinhbramwell. I will look into updating this in the coming week, in the meantime pull-requests are encouraged.

Sorry, I don't have a PR for you, but you might save yourself some time diffing your version: '0.7.2' against my version: '0.7.3'

https://github.com/warehouseman/meteor-starter-kit/tree/master/packages

Thanks for pointing this out @martinhbramwell. @arrygoo - Here's a drop-in replacement for composeWithTracker:

import { Tracker } from 'meteor/tracker';
import { compose } from 'react-komposer';

const getTrackerLoader = reactiveMapper => (
  (props, onData, env) => {
    let trackerCleanup = null;
    const handler = Tracker.nonreactive(() =>
      Tracker.autorun(() => {
        // assign the custom clean-up function.
        trackerCleanup = reactiveMapper(props, onData, env);
      })
    );

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

const composeWithTracker = data => (
  compose(getTrackerLoader(data))
);

export default composeWithTracker;

bump! (looks like a PR to fix is pending)

@andrewlorenz the fix in the PR has a very weird behaviour. It runs fine on first compile, but crashes after every server restart, complaining about not finding ./lib/react or other peer dependencies. In other words it has inconsistent compilation behaviour.

Once this issue with the PR is fixed it can be merged in.

Sorry for the delay. We have a PR to merge ASAP.

great news, thanks Paul, I'll lookout for update and give my code another go

Is there an ETA on a possible fix? I'm currently running universe:accounts-ui in a Meteor + React project but I am missing the config options the package doesn't provide and std:accounts-ui is running into a different problem with the current release and I'd like to use a package that provides configurability whilst supporting React rendering. Otherwise, I feel forced to resort to going full DIY which would be tricky enough as I expect.

@martinhbramwell @jamielob @andrewlorenz @CSMR-DB
A new release has been pushed. Would love to hear back if it fixes your problem. :)
Example app using the new release: https://github.com/okgrow/accounts-ui-react-example