-
Notifications
You must be signed in to change notification settings - Fork 35
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
#34 #37 #40 datatable row cell components #51
Conversation
@@ -1,14 +1,7 @@ | |||
{ | |||
"extends": "airbnb", |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
- https://prettier.io/docs/en/configuration.html
- https://eslint.org/docs/developer-guide/shareable-configs
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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] | ||
) |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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
- https://prettier.io/docs/en/configuration.html
- https://eslint.org/docs/developer-guide/shareable-configs
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
@joshxg Yea that's a really good idea, especially as we expand our JS usage in omSupply. |
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