Skip to content

Commit

Permalink
Logic for fixing error plot display after expression archive moved fr…
Browse files Browse the repository at this point in the history
…om ErrorPlot to ExpressionTable

Currently the logic for fixing error plot display after expression archive was done by modifying selectedExpressionId in ErrorPlot and ExpressionTable both. However this can be done in a single modification in ExpressionTable. This comit has updated ExpressionTable by modifying selectedExpressionId over there correctly and removed selectedExpressionId modification from ErrorPlot.
  • Loading branch information
parthrdesai committed May 30, 2024
1 parent 2adc32a commit cdb6af1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/herbie/ErrorPlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,7 @@ function ErrorPlot() {
const expressions = allExpressions.filter(e => !archivedExpressions.includes(e.id))

// console.log('selectedExprId', selectedExprId)
if (expressions.length > 0 && selectedExprId === -1) {
setSelectedExprId(expressions[0].id);
}

// get the expression
const selectedExpr = expressions.find(e => e.id === selectedExprId)
if (!selectedExpr) {
Expand Down
5 changes: 4 additions & 1 deletion src/herbie/ExpressionTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,10 @@ function ExpressionTable() {
<div className="delete">
<button onClick={() =>{
setArchivedExpressions([...archivedExpressions, expression.id]);
setSelectedExprId(-1);
const activeExp = activeExpressions.filter(id => id !== expression.id);
if (activeExp.length > 0) {
setSelectedExprId(activeExp[0]);
}
}}>
</button>
Expand Down

0 comments on commit cdb6af1

Please sign in to comment.