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:
Erik authored and GitHub committed 2021-03-20 18:17:14 -04:00
1 parent 2a4457b323
commit a52ffc4e79
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());