Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#34 #37 #40 datatable row cell components #51

Merged
merged 15 commits into from
Jul 30, 2019

Conversation

Chris-Petty
Copy link
Contributor

Fixes nothing really, but is a good foundation. Touches #34 #37 and #40

Change summary

Working in the example project now for convenience and rapid development. We can move the components and redirect the example to the react-native-data-table module when we're done with the bulk of the work.

Testing

Run the example project. in log-cat should see that re-rendering is chill.

Related areas to think about

@Chris-Petty Chris-Petty requested a review from josh-griffin July 25, 2019 04:31
@@ -1,14 +1,7 @@
{
"extends": "airbnb",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd just ignore the root project stuff. Though you might be interested in a discussion around whether to use airbnb linter rules or not. You might even note that I've gone sour on semi colons.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure what to contribute right now, but I'd say it's pretty appropriate to create a @openmsupply/configs repo to export linter and prettier rules

I guess I prefer semi-colons, but I don't really care as long as it's consistent. I mean, especially if a linter is doing it for me

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also agree with exporting linter and prettier rules (BE are doing this). Re configs, if they're consistent, I don't mind (although I prefer semi-colons). I think the best way to go is just use defaults across the board, just because it stops any disagreements.


const App = () => {
const [isButtonOof, toggleButton] = useState(false)
const [data, dataDispatch] = useReducer(dataReducer, baseData)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where we start getting a hint on how to use/form the new API, but there are decisions to be made on how prescribed we make this thing, mostly relating to how we pass around dataDispatch.

))
},
[columns, dataDispatch]
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current design has Cell onChange event call dataDispatch with an action like { type: 'editRowCell', newValue, rowKey, columnKey }. This ends up just being a bit rigid I think...

Ok I experimented with giving a callBack to the cell that calls the dispatch with what ever you want. But then you have another function reference to manage (boom all cells on the row re-render on an edit). useCallback isn't allowed inside a useCallback hook haha. If only there was some kind of "actionCreator" pattern prescribed by some very common library 🤔

@@ -1,14 +1,7 @@
{
"extends": "airbnb",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure what to contribute right now, but I'd say it's pretty appropriate to create a @openmsupply/configs repo to export linter and prettier rules

I guess I prefer semi-colons, but I don't really care as long as it's consistent. I mean, especially if a linter is doing it for me

@Chris-Petty
Copy link
Contributor Author

@joshxg Yea that's a really good idea, especially as we expand our JS usage in omSupply.

@Chris-Petty Chris-Petty merged commit a5d748c into develop Jul 30, 2019
@Chris-Petty Chris-Petty deleted the #34-#37-#40-datatable-row-cell-components branch July 30, 2019 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants