mirror of
https://github.com/wassname/talk.git
synced 2026-07-07 11:45:13 +08:00
Lazy load all plugin parts
This commit is contained in:
@@ -6,7 +6,7 @@ import isEqual from 'lodash/isEqual';
|
||||
import I18n from 'coral-framework/modules/i18n/i18n';
|
||||
import translations from 'coral-framework/translations';
|
||||
const lang = new I18n(translations);
|
||||
import {queriesAndMutators as pluginQueriesAndMutators} from 'coral-framework/helpers/plugins';
|
||||
import {getPluginQueriesAndMutators} from 'coral-framework/helpers/plugins';
|
||||
|
||||
import {TabBar, Tab, TabContent, Spinner} from 'coral-ui';
|
||||
|
||||
@@ -306,5 +306,5 @@ export default compose(
|
||||
removeCommentTag,
|
||||
deleteAction,
|
||||
queryStream,
|
||||
...pluginQueriesAndMutators,
|
||||
...getPluginQueriesAndMutators(),
|
||||
)(Embed);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import * as authActions from './auth';
|
||||
import * as assetActions from './asset';
|
||||
import * as notificationActions from './notification';
|
||||
import {actions as pluginActions} from '../helpers/plugins';
|
||||
import {getPluginActions} from '../helpers/plugins';
|
||||
|
||||
export default {
|
||||
authActions,
|
||||
assetActions,
|
||||
notificationActions,
|
||||
pluginActions,
|
||||
pluginActions: getPluginActions(),
|
||||
};
|
||||
|
||||
@@ -24,17 +24,22 @@ export function getSlotElements(slot, props = {}) {
|
||||
.map(o => React.createElement(o.component, o.props));
|
||||
}
|
||||
|
||||
// actions is a map of redux actions .
|
||||
export const actions = merge(...plugins.actions.map(o => ({...o.module()})));
|
||||
// Returns a map of redux actions.
|
||||
export function getPluginActions() {
|
||||
return merge(...plugins.actions.map(o => ({...o.module()})));
|
||||
}
|
||||
|
||||
// reducers is a map of redux reducers.
|
||||
export const reducers = merge(...plugins.reducers.map(o => ({...o.module()})));
|
||||
|
||||
// queriesAndMutators is an array of graphQL queries and mutators.
|
||||
export const queriesAndMutators = flatten(
|
||||
merge(
|
||||
plugins.queries.map(o => values(o.module())),
|
||||
plugins.mutators.map(o => values(o.module())),
|
||||
)
|
||||
);
|
||||
// Returns a map of redux reducers.
|
||||
export function getPluginReducers() {
|
||||
merge(...plugins.reducers.map(o => ({...o.module()})));
|
||||
}
|
||||
|
||||
// Returns an array of graphQL queries and mutators.
|
||||
export function getPluginQueriesAndMutators() {
|
||||
return flatten(
|
||||
merge(
|
||||
plugins.queries.map(o => values(o.module())),
|
||||
plugins.mutators.map(o => values(o.module())),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import auth from './auth';
|
||||
import user from './user';
|
||||
import asset from './asset';
|
||||
import {reducers as pluginReducers} from '../helpers/plugins';
|
||||
import {getPluginReducers} from '../helpers/plugins';
|
||||
|
||||
export default {
|
||||
auth,
|
||||
user,
|
||||
asset,
|
||||
...pluginReducers
|
||||
...getPluginReducers()
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user