aglinxinyuan opened a new issue, #7037:
URL: https://github.com/apache/texera/issues/7037
### Task Summary
Two pieces of frontend state are maintained but not needed.
**1. `OperatorPaginationResultService.getPrevStats` is dead API.**
`getPrevStats()` has no caller anywhere in `src/` — not from TypeScript, not
from a template. Its backing field `prevStatsCache` is written only to feed it,
so the whole rotate-into-the-previous-slot dance in `handleStatsUpdate` exists
for a reader that does not exist:
```ts
public handleStatsUpdate(statsUpdate): void {
if (!this.statsCache) { // statsCache is initialised to {} and
only ever
this.statsCache = statsUpdate; // reassigned to another object, so this
branch
this.prevStatsCache = statsUpdate; // is unreachable
} else {
this.prevStatsCache = this.statsCache;
this.statsCache = statsUpdate;
}
}
```
Once `prevStatsCache` goes, the method is `this.statsCache = statsUpdate;`
and the dead `if` disappears with it.
Note this is unrelated to `WorkflowResultService.getResultTableStats()`,
which delivers previous/current stats pairs to the UI via rxjs `pairwise()` —
that is the mechanism actually in use.
**2. `SearchBarComponent.queryOrder` duplicates `Map` insertion order.**
The search cache keeps a parallel `string[]` purely to know which key to
evict. A JavaScript `Map` already iterates in insertion order, and `addToCache`
is only reached on a cache miss (a hit returns early), so the array can never
diverge from the Map's own key order. `this.searchCache.keys().next().value` is
the oldest key.
Neither change alters behaviour. −23 lines, +13.
### Task Type
- [x] Refactor / Cleanup
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]