Skip to content

Commit

Permalink
chore: update ssr-with-ts ykfe-utils 依赖移除rax
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyuang committed Mar 11, 2020
1 parent 5b5e018 commit 85ae2af
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 30 deletions.
2 changes: 1 addition & 1 deletion example/ssr-with-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ssr-with-ts",
"version": "2.3.1",
"version": "2.3.2",
"description": "ykfe",
"dependencies": {
"egg-scripts": "^2.10.0",
Expand Down
3 changes: 1 addition & 2 deletions example/ssr-with-ts/web/entry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import React from 'react'
import ReactDOM from 'react-dom'
import { BrowserRouter, StaticRouter, Route, Switch } from 'react-router-dom'
import { Context } from 'midway'
import { getWrappedComponent, getComponent } from 'ykfe-utils'
import { RouteItem } from './interface/route'
import { getWrappedComponent, getComponent, RouteItem } from 'ykfe-utils'
import defaultLayout from './layout'

const { routes } = require('../config/config.ssr')
Expand Down
7 changes: 0 additions & 7 deletions example/ssr-with-ts/web/interface/config.ts

This file was deleted.

5 changes: 0 additions & 5 deletions example/ssr-with-ts/web/interface/route.ts

This file was deleted.

18 changes: 5 additions & 13 deletions example/ssr-with-ts/web/page/news/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from 'react'
import { RouteComponentProps } from 'react-router'
import { Context } from 'midway'
import './index.less'
interface MockData {
[index: number]: string
[index: string]: string
}
const mockData: MockData = {
1: `Racket-on-Chez continues to improve. Snapshot builds are currently available at pre.racket-lang.org, and we expect that Racket-on-Chez will be included as a download option in the next release.`,
Expand All @@ -11,16 +13,6 @@ const mockData: MockData = {
5: `Product advertisement and promotion on YouTube is a function of the dedicated audience (or influence) of the individual (influencer) anchoring the advertising or promotion.`
}

interface Match {
params: Params
}
interface Params {
id: number
}
interface Ctx {
match: Match,
params: Params
}
interface Props {
newsDetail: string
}
Expand All @@ -32,8 +24,8 @@ const News: SFC<Props> = (props: Props) => {
)
}

News.getInitialProps = (ctx: Ctx) => {
const newsId = __isBrowser__ ? ctx.match.params.id : ctx.params.id
News.getInitialProps = (ctx) => {
const newsId = __isBrowser__ ? (ctx as RouteComponentProps<{id: string}>).match.params.id : (ctx as Context).request.path.split('/')[2]
return Promise.resolve({
newsDetail: mockData[newsId]
})
Expand Down
3 changes: 1 addition & 2 deletions packages/ykfe-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ykfe-utils",
"version": "3.5.5",
"version": "3.5.6",
"description": "utils for ykfe",
"main": "lib/index.js",
"module": "es/index.js",
Expand All @@ -19,7 +19,6 @@
"lodash.clonedeepwith": "^4.5.0",
"merge-stream": "^2.0.0",
"path-to-regexp": "^6.1.0",
"rax": "^1.1.1",
"rax-server-renderer": "^1.1.6",
"react": "^16.8.6",
"react-dom": "^16.8.6",
Expand Down

0 comments on commit 85ae2af

Please sign in to comment.