abstract promote thread into a hook for use in both native and web. We're using the same API call and reducer in web, all we need to do is pull the call in native into lib so we can use it in two places.
Details
n/a hook is not used yet, code is a copy/paste from: https://github.com/CommE2E/comm/blob/master/native/chat/settings/thread-settings-promote-sidebar.react.js in native.
Diff Detail
- Repository
- rCOMM Comm
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
lib/hooks/promote-sidebar.react.js | ||
---|---|---|
16–17 ↗ | (On Diff #11521) | Prefer $ReadOnly types! This should be something you're deeply aware of given you're researching covariance/contravariance right now. You will get this comment for every new type you introduce – please try to grok it and integrate it going forward |
43 ↗ | (On Diff #11521) |
|
lib/hooks/promote-sidebar.react.js | ||
---|---|---|
16–17 ↗ | (On Diff #11521) | Sorry! Thanks for catching this. Adding the additional + is pretty subtle and I just forgot. I need to be more aware. |
lib/hooks/promote-sidebar.react.js | ||
---|---|---|
22 ↗ | (On Diff #11615) |
It seems like this should probably just be mixed? |
lib/hooks/promote-sidebar.react.js | ||
---|---|---|
22 ↗ | (On Diff #11615) | const onError = e => { Alert.alert('Unknown error', 'Uhh... try again?', undefined, { cancelable: true, }); throw e; }; in D3755 we take the error message and throw it. But, I guess we could just throw it here in the hook and call it a day. Is that what you're getting at @ashoat?
I think mixed would make sense if error needed to be used outside of the function. But, to your point in 1. I don't think we need to do that, or type it at all. Looking at the code base, catch(e) is never explicitly typed. |