(item: IProblemsItem<T> | IProblemsItem<T>[])
| 95 | ); |
| 96 | } |
| 97 | public update<T>(item: IProblemsItem<T> | IProblemsItem<T>[]) { |
| 98 | const problems = Array.isArray(item) ? item : [item]; |
| 99 | const { data } = this.state; |
| 100 | |
| 101 | problems.forEach((problem) => { |
| 102 | const index = data.findIndex(searchById(problem.id)); |
| 103 | if (index > -1) { |
| 104 | data.splice(index, 1, problem); |
| 105 | } else { |
| 106 | logger.error( |
| 107 | `Update problems failed, because there is no problem found via ${problem.id}` |
| 108 | ); |
| 109 | } |
| 110 | }); |
| 111 | |
| 112 | this.setState( |
| 113 | { |
| 114 | data: [...data], |
| 115 | }, |
| 116 | () => { |
| 117 | this.updateStatusBar(); |
| 118 | } |
| 119 | ); |
| 120 | } |
| 121 | public remove(id: UniqueId | UniqueId[]): void { |
| 122 | const ids = Array.isArray(id) ? id : [id]; |
| 123 |
nothing calls this directly
no test coverage detected