mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
Feature/twitter refresh (#160)
* receive and process broadcasted tweets to the clients * removing profile fetch and cleaning up unused functions * defend against null profile * move defenseive check to top pof notifications * fix bug where delete was visible for non owners * remove polling implementation
This commit is contained in:
4 files changed
+50
-25
No files matched your search
@@ -34,28 +34,12 @@ const useStyles = makeStyles(() => ({
|
||||
},
|
||||
}));
|
||||
|
||||
const TWEETS_REFRESH_RATE = 15000; // TODO move this to twitter config
|
||||
|
||||
export const TwitterApp = () => {
|
||||
const classes = useStyles();
|
||||
const { modalVisible, setModalVisible } = useModal();
|
||||
const [activePage, setActivePage] = useState(0);
|
||||
const { profile } = useProfile();
|
||||
|
||||
useEffect(() => {
|
||||
// this is a polling implementation. It is possible that
|
||||
// there is some interaction where, on a new tweet, all
|
||||
// clients are sent the updated query data. Until that can
|
||||
// be accomplished this is naive but robust.
|
||||
//
|
||||
// TODO don't call fetchTweets - implement a function that only
|
||||
// returns tweets that we don't already have
|
||||
const timeout = window.setTimeout(() => {
|
||||
Nui.send('phone:fetchTweets', {});
|
||||
}, TWEETS_REFRESH_RATE);
|
||||
return () => window.clearTimeout(timeout);
|
||||
}, []);
|
||||
|
||||
// before any other action can be taken by the user we force
|
||||
// them have a profile name
|
||||
const promptProfileName = profile && (!profile.profile_name || !profile.profile_name.trim());
|
||||
|
||||
Reference in new issue
Block a user