-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 #48696 from daledah/fix/47888
feat: Subscribe guides to a new presence pusher channel
- Loading branch information
Showing
6 changed files
with
44 additions
and
5 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
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,21 @@ | ||
import {useEffect, useRef} from 'react'; | ||
import {useOnyx} from 'react-native-onyx'; | ||
import {subscribeToActiveGuides} from '@userActions/User'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
|
||
function ActiveGuidesEventListener() { | ||
const [user] = useOnyx(ONYXKEYS.USER); | ||
const didSubscribeToActiveGuides = useRef(false); | ||
useEffect(() => { | ||
if (didSubscribeToActiveGuides.current) { | ||
return; | ||
} | ||
if (user?.isGuide) { | ||
didSubscribeToActiveGuides.current = true; | ||
subscribeToActiveGuides(); | ||
} | ||
}, [user]); | ||
return null; | ||
} | ||
|
||
export default ActiveGuidesEventListener; |
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