GriddleGriddle / Griddle

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

Overriden delectors from plugins not being applied as expected #738

Open shorja opened 7 years ago

shorja commented 7 years ago

Griddle version

1.8.1

Expected Behavior

Selectors defined in plugins overwrite the "base" ones.

Actual Behavior

Due to most if not all of the base components hard referencing the selectors in the dataSelectors.js, the overwrite does nothing. My suggestion is to reference the selectors off context all the time so that the overriding behaviour works as expected. I will try this out and put together a PR.

Steps to reproduce

Using Griddle without any of the "internal" plugins, create a plugin that overrides the dataSelector to return null. I expect the behaviour to be completely broken but the table seems fine.

Pull request with failing test or storybook story with issue

ryanlanciaux commented 7 years ago

Context would be a good path for this. I've kind of been playing around with a generic "plugin" registration module and that's kind of how it works. You register every part on an object on context and request it back out.

The initial intent with Griddle 1.0 was to override any container that needed to change a selector that was used but totally understand that's a lot more overhead and not as standard in the React ecosystem as having things provided via context.

shorja commented 7 years ago

Also, I wonder if it would make sense to move the baseline table code into a plugin, since it feels like at its core Griddle is a means of creating a component with overridable and composable features, it doesn't even really need to be a table per se.

ryanlanciaux commented 7 years ago

I think we're getting into maybe some of the thoughts that I was looking to address as part of a 2.0 or 3.0 release. I've been working on a different module that is the reusable component library and Griddle would be a distinct implementation of this (still having extension points and what not).