1
0
mirror of https://github.com/flarum/core.git synced 2025-10-10 14:34:30 +02:00

Allow extensions to use route resolvers (#2275)

- mapRoutes: don't wrap components in resolvers if they are already resolvers
- Extract defaultResolver into its own class
- Allow either route resolver instances, or components with an optional resolverClass which should accept the component and route name in its constructor.
- Introduce a resolver for DiscussionPage, so that routing from one post to another on the same discussion triggers a scroll instead of rerendering
This commit is contained in:
Alexander Skvortsov
2020-10-15 18:01:17 -04:00
committed by GitHub
parent c1d91be2f4
commit 988b6c9023
6 changed files with 100 additions and 9 deletions

View File

@@ -71,6 +71,7 @@ import Search from './components/Search';
import DiscussionListItem from './components/DiscussionListItem';
import LoadingPost from './components/LoadingPost';
import PostsUserPage from './components/PostsUserPage';
import DiscussionPageResolver from './resolver/DiscussionPageResolver';
import routes from './routes';
import ForumApplication from './ForumApplication';
@@ -146,6 +147,7 @@ export default Object.assign(compat, {
'components/DiscussionListItem': DiscussionListItem,
'components/LoadingPost': LoadingPost,
'components/PostsUserPage': PostsUserPage,
'resolvers/DiscussionPageResolver': DiscussionPageResolver,
routes: routes,
ForumApplication: ForumApplication,
});