Skip to content

Instantly share code, notes, and snippets.

@mrsharpoblunto
Created October 7, 2019 20:49
Show Gist options
  • Save mrsharpoblunto/686606b325b929269d68d62ae8b98afd to your computer and use it in GitHub Desktop.
Save mrsharpoblunto/686606b325b929269d68d62ae8b98afd to your computer and use it in GitHub Desktop.
function fetchAndStageFeed() {
return stagingAction(
'feed',
(async () => {
const {data} = await fetchFeedTimeline();
return {
type: FEED_LOADED,
...data,
};
})(),
);
}
// Fetches the new feed and stages it
store.dispatch(fetchAndStageFeed());
// any other actions dispatched until the stagingCommit action
// will be applied to the 'feed' staged state
// Commits staging to the current state
store.dispatch(stagingCommit('feed'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment