@@ -6,27 +6,12 @@ import NextSeo from 'next-seo'
66import { PAGE_SIZE , SITE_URL } from '@config'
77import initRootStore from '@stores/init'
88
9- import AnalysisService from '@services/Analysis'
10- import GlobalLayout from '@containers/GlobalLayout'
11- import ThemeWrapper from '@containers/ThemeWrapper'
12- import MultiLanguage from '@containers/MultiLanguage'
13- import Sidebar from '@containers/Sidebar'
14- import Preview from '@containers/Preview'
15- import Doraemon from '@containers/Doraemon'
16- import Route from '@containers/Route'
17- import Header from '@containers/Header'
18- import CommunityBanner from '@containers/CommunityBanner'
19- import CommunityContent from '@containers/CommunityContent'
20- import Footer from '@containers/Footer'
21- import ErrorBox from '@containers/ErrorBox'
22- import ErrorPage from '@components/ErrorPage'
23-
249import {
10+ isServerSide ,
2511 getJwtToken ,
2612 makeGQClient ,
2713 queryStringToJSON ,
28- getMainPath ,
29- getSubPath ,
14+ parseURL ,
3015 akaTranslate ,
3116 extractThreadFromPath ,
3217 buildLog ,
@@ -40,6 +25,21 @@ import {
4025 parseTheme ,
4126} from '@utils'
4227
28+ import AnalysisService from '@services/Analysis'
29+ import GlobalLayout from '@containers/GlobalLayout'
30+ import ThemeWrapper from '@containers/ThemeWrapper'
31+ import MultiLanguage from '@containers/MultiLanguage'
32+ import Sidebar from '@containers/Sidebar'
33+ import Preview from '@containers/Preview'
34+ import Doraemon from '@containers/Doraemon'
35+ import Route from '@containers/Route'
36+ import Header from '@containers/Header'
37+ import CommunityBanner from '@containers/CommunityBanner'
38+ import CommunityContent from '@containers/CommunityContent'
39+ import Footer from '@containers/Footer'
40+ import ErrorBox from '@containers/ErrorBox'
41+ import ErrorPage from '@components/ErrorPage'
42+
4343import { P } from '@schemas'
4444
4545/* eslint-disable-next-line */
@@ -59,10 +59,8 @@ async function fetchData(props, opt) {
5959 const { asPath } = props
6060 // schema
6161
62- // utils: filter, tags staff
63- const mainPath = getMainPath ( props )
62+ const { mainPath, subPath : topic } = parseURL ( props )
6463 const community = akaTranslate ( mainPath )
65- const topic = getSubPath ( props )
6664 const thread = extractThreadFromPath ( props )
6765
6866 let filter = addTopicIfNeed (
@@ -107,8 +105,9 @@ async function fetchData(props, opt) {
107105
108106export default class CommunityPage extends React . Component {
109107 static async getInitialProps ( props ) {
110- const mainPath = getMainPath ( props )
111- const subPath = getSubPath ( props )
108+ if ( ! isServerSide ( ) ) return { }
109+
110+ const { mainPath, subPath } = parseURL ( props )
112111 const thread = extractThreadFromPath ( props )
113112
114113 let resp
0 commit comments