Skip to content

Commit

Permalink
set new resource state earlier to avoid re-selecting deleted or not f…
Browse files Browse the repository at this point in the history
…ound placeholder
  • Loading branch information
matt-deboer committed Jan 4, 2018
1 parent 1419aff commit 39bbfe8
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions pkg/ui/src/state/reducers/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,9 @@ function doUpdateResource(state, resource, isNew, kubeKinds) {
return state
}

let newState = {...state}
let newState = {...state, resources: {...state.resources}}
newState.resources[resource.key] = resource

updateRelatedResources(newState, resource)
if (resource.kind in excludedKinds) {
return newState
Expand Down Expand Up @@ -333,19 +335,12 @@ function doUpdateResource(state, resource, isNew, kubeKinds) {
}
}

newState.resources[resource.key] = resource
if (sameResource(newState.resource, resource)) {
newState.resources = resource
newState = doSelectResource(newState,
resource.metadata.namespace, resource.kind, resource.metadata.name)
}


newState.resources = {...newState.resources}
if (newState.resource && newState.resource.key === resource.key) {
newState.resource = resource
}

if (!applyFilters(newState.globalFilters, newState.filters, resource)) {
updateAutocomplete(newState, resource, resourceGroup)
}
Expand Down

0 comments on commit 39bbfe8

Please sign in to comment.