about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/ui/util
diff options
context:
space:
mode:
authorSorin Davidoi <sorin.davidoi@gmail.com>2017-07-09 12:16:08 +0200
committerEugen Rochko <eugen@zeonfederated.com>2017-07-09 12:16:08 +0200
commit37c832cdf7a307511b27e64174ed1a3e160ec66e (patch)
treed06be7f23f6634286ffd7adf4fcddd3cbd6c3384 /app/javascript/mastodon/features/ui/util
parentf68fa930ea448f5e94057160cfdcc78fec4aba11 (diff)
refactor: Make all reducers sync (#4125)
Diffstat (limited to 'app/javascript/mastodon/features/ui/util')
-rw-r--r--app/javascript/mastodon/features/ui/util/async-components.js41
1 files changed, 3 insertions, 38 deletions
diff --git a/app/javascript/mastodon/features/ui/util/async-components.js b/app/javascript/mastodon/features/ui/util/async-components.js
index 56880dd1f..55de114b5 100644
--- a/app/javascript/mastodon/features/ui/util/async-components.js
+++ b/app/javascript/mastodon/features/ui/util/async-components.js
@@ -1,40 +1,13 @@
-import { store } from '../../../containers/mastodon';
-import { refreshNotifications } from '../../../actions/notifications';
-import { injectAsyncReducer } from '../../../store/configureStore';
-
-// NOTE: When lazy-loading reducers, make sure to add them
-// to application.html.haml (if the component is preloaded there)
-
 export function EmojiPicker () {
   return import(/* webpackChunkName: "emojione_picker" */'emojione-picker');
 }
 
 export function Compose () {
-  return Promise.all([
-    import(/* webpackChunkName: "features/compose" */'../../compose'),
-    import(/* webpackChunkName: "reducers/compose" */'../../../reducers/compose'),
-    import(/* webpackChunkName: "reducers/media_attachments" */'../../../reducers/media_attachments'),
-    import(/* webpackChunkName: "reducers/search" */'../../../reducers/search'),
-  ]).then(([component, composeReducer, mediaAttachmentsReducer, searchReducer]) => {
-    injectAsyncReducer(store, 'compose', composeReducer.default);
-    injectAsyncReducer(store, 'media_attachments', mediaAttachmentsReducer.default);
-    injectAsyncReducer(store, 'search', searchReducer.default);
-
-    return component;
-  });
+  return import(/* webpackChunkName: "features/compose" */'../../compose');
 }
 
 export function Notifications () {
-  return Promise.all([
-    import(/* webpackChunkName: "features/notifications" */'../../notifications'),
-    import(/* webpackChunkName: "reducers/notifications" */'../../../reducers/notifications'),
-  ]).then(([component, notificationsReducer]) => {
-    injectAsyncReducer(store, 'notifications', notificationsReducer.default);
-
-    store.dispatch(refreshNotifications());
-
-    return component;
-  });
+  return import(/* webpackChunkName: "features/notifications" */'../../notifications');
 }
 
 export function HomeTimeline () {
@@ -110,15 +83,7 @@ export function MediaModal () {
 }
 
 export function OnboardingModal () {
-  return Promise.all([
-    import(/* webpackChunkName: "modals/onboarding_modal" */'../components/onboarding_modal'),
-    import(/* webpackChunkName: "reducers/compose" */'../../../reducers/compose'),
-    import(/* webpackChunkName: "reducers/media_attachments" */'../../../reducers/media_attachments'),
-  ]).then(([component, composeReducer, mediaAttachmentsReducer]) => {
-    injectAsyncReducer(store, 'compose', composeReducer.default);
-    injectAsyncReducer(store, 'media_attachments', mediaAttachmentsReducer.default);
-    return component;
-  });
+  return import(/* webpackChunkName: "modals/onboarding_modal" */'../components/onboarding_modal');
 }
 
 export function VideoModal () {