Ensure event actually fires when the timeline is loaded

This commit is contained in:
Nat 2022-05-19 17:55:21 -07:00
parent f889540ba5
commit 04fb46404f
3 changed files with 13 additions and 8 deletions

View File

@ -64,9 +64,11 @@ const Feed = (props) => {
); );
}, []); }, []);
const _handleTimelineLoaded = () => setState({...state, const _handleTimelineLoaded = () => {
postsRendered: true, setState({...state,
}); postsRendered: true,
});
};
let endOfTimelineMessage = <></>; let endOfTimelineMessage = <></>;
if (state.postsRendered) { if (state.postsRendered) {

View File

@ -220,13 +220,14 @@ export const PostByData = (props) => {
own, own,
loaded: true loaded: true
}); });
if (props.onPostLoaded != null) {
props.onPostLoaded();
}
}); });
}, []); }, []);
useEffect(() => {
// This is run after the state has been updated
props.onPostLoaded();
}, [state])
const _handleFavourite = async () => { const _handleFavourite = async () => {
let newStatus; let newStatus;

View File

@ -23,7 +23,9 @@ const TimelineView = (props) => {
} }
}, [postsLoaded]); }, [postsLoaded]);
_handlePostLoaded = () => setPostsLoaded(postsLoaded + 1); const _handlePostLoaded = () => {
setPostsLoaded(postsLoaded + 1);
}
return ( return (
<View> <View>