GriddleGriddle / Griddle

Simple Grid Component written in React
http://griddlegriddle.github.io/Griddle/
MIT License
2.5k stars 377 forks source link

Enhancers are overridden when mutiple plugins with the same enhancer exist #741

Closed sel129 closed 7 years ago

sel129 commented 7 years ago

Griddle version

1.8.1

Expected Behavior

I have a situation where I have created 2 plugins. Both have a RowEnhancer. I expect that the RowEnhancer from both plugins will be applied to the Row Component.

Actual Behavior

What i'm seeing is that the RowEnhancer from the last plugin in the plugin list is applied, but not the others.

Steps to reproduce

I have a grid that looks like this:

<Griddle
        data={fakeData}
        plugins={[BPlugin, APlugin]}
      />

APlugin:


const EnhancedRow = OriginalComponent => compose(
  connect((state, props) => {
    return {
    };
  })
)(props => {
  return (
    <div>
    a
    <OriginalComponent {...props} />
    </div>
  );
});

export default EnhancedRow;

BPlugin:

const EnhancedRow = OriginalComponent => compose(
  connect((state, props) => {
    return {
    };
  })
)(props => {
  return (
    <div>
    b
    <OriginalComponent {...props} />
    </div>
  );
});

export default EnhancedRow;

The only difference between APlugin and BPlugin is letter which the row gets wrapped with. a or b. I'm finding that the row gets wrapped with a only, and not b.

Pull request with failing test or storybook story with issue

None yet.

While this step is not necessary, a failing test(s) and/or a storybook story will help us resolve the issue much more easily. Please see the README for more information.

dahlbyk commented 7 years ago

I'm going to close this in favor of #733. I have replied over there.