-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #462 from fabioh8010/feature/useOnyx
Implement useOnyx hook
- Loading branch information
Showing
16 changed files
with
1,436 additions
and
1,616 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,7 @@ module.exports = { | |
tsx: 'never', | ||
}, | ||
], | ||
'rulesdir/prefer-onyx-connect-in-libs': 'off', | ||
}, | ||
}, | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,23 @@ | ||
import Onyx, {OnyxUpdate, ConnectOptions} from './Onyx'; | ||
import {CustomTypeOptions, OnyxCollection, OnyxEntry, NullishDeep, KeyValueMapping, OnyxKey, Selector, WithOnyxInstanceState} from './types'; | ||
import {CustomTypeOptions, OnyxCollection, OnyxEntry, NullishDeep, KeyValueMapping, OnyxKey, Selector, WithOnyxInstanceState, OnyxValue} from './types'; | ||
import withOnyx from './withOnyx'; | ||
import useOnyx, {UseOnyxResult, FetchStatus} from './useOnyx'; | ||
|
||
export default Onyx; | ||
export {CustomTypeOptions, OnyxCollection, OnyxEntry, OnyxUpdate, withOnyx, ConnectOptions, NullishDeep, KeyValueMapping, OnyxKey, Selector, WithOnyxInstanceState}; | ||
export { | ||
CustomTypeOptions, | ||
OnyxCollection, | ||
OnyxEntry, | ||
OnyxUpdate, | ||
withOnyx, | ||
ConnectOptions, | ||
NullishDeep, | ||
KeyValueMapping, | ||
OnyxKey, | ||
Selector, | ||
WithOnyxInstanceState, | ||
useOnyx, | ||
UseOnyxResult, | ||
OnyxValue, | ||
FetchStatus, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import Onyx from './Onyx'; | ||
import withOnyx from './withOnyx'; | ||
import useOnyx from './useOnyx'; | ||
|
||
export default Onyx; | ||
export {withOnyx}; | ||
export {withOnyx, useOnyx}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import {useRef} from 'react'; | ||
|
||
/** | ||
* Creates a mutable reference to a value, useful when you need to | ||
* maintain a reference to a value that may change over time without triggering re-renders. | ||
*/ | ||
function useLiveRef<T>(value: T) { | ||
const ref = useRef<T>(value); | ||
ref.current = value; | ||
|
||
return ref; | ||
} | ||
|
||
export default useLiveRef; |
Oops, something went wrong.