Skip to content

Conversation

@AhyoungRyu
Copy link
Contributor

Addresses https://sendbird.atlassian.net/browse/AC-690

I 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.

tl;dr

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;
}

@AhyoungRyu AhyoungRyu merged commit 172c3c3 into main Nov 2, 2023
@AhyoungRyu AhyoungRyu deleted the feat/AC-690/export-message-fetch-hook branch November 2, 2023 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants