Commit 172c3c3
authored
feat: export initialMessagesFetch callback from hook (#829)
Addresses https://sendbird.atlassian.net/browse/AC-690
Took the logic inside of useInitialMessagesFetch's effect hook and
made a callback function. And made the function to be returned from the
hook to make it be from outside of UIKit.
#### Before
```
function useInitialMessagesFetch(params): void {
useEffect(() => {
all the logics..
}, [deps]}
}
```
#### After
```
function useInitialMessagesFetch(params): () => void {
const fetchMessages() => useCallback(() => {
all the logics..
, [deps]}
useEffect(() => {
fetchMessages();
}, [fetchMessages]}
return fetchMessages;
}
```1 parent 7b3c218 commit 172c3c3
File tree
2 files changed
+17
-11
lines changed- src/modules/Channel/context/hooks
2 files changed
+17
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| |||
Lines changed: 16 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
41 | 48 | | |
42 | 49 | | |
43 | 50 | | |
| |||
129 | 136 | | |
130 | 137 | | |
131 | 138 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
140 | 145 | | |
141 | 146 | | |
142 | 147 | | |
0 commit comments