Skip to content
Snippets Groups Projects
Commit d9e2c231 authored by piotr.kupczyk@id.ethz.ch's avatar piotr.kupczyk@id.ethz.ch
Browse files

Revert "SSDM-11169 : Properties overview in the new admin UI - improve...

Revert "SSDM-11169 : Properties overview in the new admin UI - improve performance of navigation browser by reducing the number of re-renders when a filter value is typed"

This reverts commit 1438b021.
parent 520b24a1
No related branches found
No related tags found
No related merge requests found
...@@ -33,7 +33,6 @@ export default class BrowserController { ...@@ -33,7 +33,6 @@ export default class BrowserController {
context.initState({ context.initState({
loaded: false, loaded: false,
filter: '', filter: '',
usedFilter: '',
nodes: [], nodes: [],
selectedId: null, selectedId: null,
selectedObject: null, selectedObject: null,
...@@ -44,8 +43,12 @@ export default class BrowserController { ...@@ -44,8 +43,12 @@ export default class BrowserController {
load() { load() {
return this.doLoadNodes().then(loadedNodes => { return this.doLoadNodes().then(loadedNodes => {
const { filter, nodes, selectedId, selectedObject } = const {
this.context.getState() filter,
nodes,
selectedId,
selectedObject
} = this.context.getState()
let newNodes = this._createNodes(loadedNodes) let newNodes = this._createNodes(loadedNodes)
newNodes = this._filterNodes(newNodes, filter) newNodes = this._filterNodes(newNodes, filter)
...@@ -61,7 +64,6 @@ export default class BrowserController { ...@@ -61,7 +64,6 @@ export default class BrowserController {
this.context.setState({ this.context.setState({
loaded: true, loaded: true,
usedFilter: filter,
nodes: newNodes nodes: newNodes
}) })
}) })
...@@ -118,42 +120,35 @@ export default class BrowserController { ...@@ -118,42 +120,35 @@ export default class BrowserController {
} }
filterChange(newFilter) { filterChange(newFilter) {
this.context.setState({ const {
filter: newFilter filter,
}) nodes,
selectedId,
if (this.filterTimerId) { selectedObject
clearTimeout(this.filterTimerId) } = this.context.getState()
this.filterTimerId = null
}
this.filterTimerId = setTimeout(async () => {
const { filter, usedFilter, nodes, selectedId, selectedObject } =
this.context.getState()
let initialNodes = null let initialNodes = null
if (filter.startsWith(usedFilter)) { if (newFilter.startsWith(filter)) {
initialNodes = nodes initialNodes = nodes
} else { } else {
initialNodes = this.loadedNodes initialNodes = this.loadedNodes
} }
let newNodes = this._createNodes(initialNodes) let newNodes = this._createNodes(initialNodes)
newNodes = this._filterNodes(newNodes, newFilter) newNodes = this._filterNodes(newNodes, newFilter)
newNodes = this._setNodesExpanded( newNodes = this._setNodesExpanded(
newNodes, newNodes,
this._getParentNodes(newNodes), this._getParentNodes(newNodes),
true true
) )
newNodes = this._setNodesSelected(newNodes, selectedId, selectedObject) newNodes = this._setNodesSelected(newNodes, selectedId, selectedObject)
this._sortNodes(newNodes) this._sortNodes(newNodes)
this.context.setState({ this.context.setState({
usedFilter: filter, filter: newFilter,
nodes: newNodes nodes: newNodes
}) })
}, 200)
} }
nodeExpand(nodeId) { nodeExpand(nodeId) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment