Skip to content

Commit

Permalink
web: remove some dependencies (#4149)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicks committed Feb 4, 2021
1 parent 7809636 commit c1ca6f2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 219 deletions.
6 changes: 0 additions & 6 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,25 @@
"@types/history": "^4.7.2",
"@types/js-cookie": "^2.2.2",
"@types/jsdom": "^12.2.4",
"@types/lodash": "^4.14.138",
"@types/node": "^12.7.12",
"@types/react": "^16.9.0",
"@types/react-dom": "^16.9.0",
"@types/react-helmet": "^5.0.8",
"@types/react-modal": "^3.8.2",
"@types/react-router-dom": "^5.1.0",
"@types/react-select": "^2.0.15",
"@types/react-timeago": "^4.1.0",
"@types/styled-components": "^5.1.0",
"ansi-to-react": "^5.0.0",
"babel-loader": "8.1.0",
"history": "^4.9.0",
"js-cookie": "^2.2.1",
"lodash": "^4.17.19",
"moment": "^2.24.0",
"node-sass": "^4.14.1",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-helmet": "^5.2.0",
"react-modal": "^3.10.1",
"react-outline-manager": "^1.2.2",
"react-router-dom": "^5.1.0",
"react-scripts": "^4.0.1",
"react-select": "^2.4.2",
"react-storage-hooks": "^4.0.1",
"react-timeago": "^4.4.0",
"styled-components": "^5.1.1",
Expand Down
13 changes: 8 additions & 5 deletions web/src/HUD.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { History, UnregisterCallback } from "history"
import * as _ from "lodash"
import React, { Component } from "react"
import { matchPath, useHistory } from "react-router"
import { Route, RouteComponentProps, Switch } from "react-router-dom"
Expand Down Expand Up @@ -158,7 +157,8 @@ export default class HUD extends Component<HudProps, HudState> {

setAppState<K extends keyof HudState>(state: Pick<HudState, K>) {
this.setState((prevState) => {
let newState = _.clone(state) as any
let newState: any = {}
Object.assign(newState, state)
newState.logStore = prevState.logStore ?? new LogStore()

let newLogList = newState.view?.logList
Expand Down Expand Up @@ -193,15 +193,18 @@ export default class HUD extends Component<HudProps, HudState> {
}

snapshotFromState(state: HudState): Proto.webviewSnapshot {
let view = _.cloneDeep(state.view ?? null)
if (view && state.logStore) {
let view: any = {}
if (state.view) {
Object.assign(view, state.view)
}
if (state.logStore) {
view.logList = state.logStore.toLogList(maxSnapshotLogSize)
}
return {
view: view,
isSidebarClosed: !!state.isSidebarClosed,
path: this.props.history.location.pathname,
snapshotHighlight: _.cloneDeep(state.snapshotHighlight),
snapshotHighlight: state.snapshotHighlight,
}
}

Expand Down

0 comments on commit c1ca6f2

Please sign in to comment.