Skip to content

Commit b0915d9

Browse files
fix table sort and initial filter
1 parent db8302c commit b0915d9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/OptimizerView.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function partitionWorlds(ingredients, worlds) {
4444
}
4545

4646
function OptimizerView({worlds, encyclopedia, golem}) {
47-
const [filteredInfo, setFilteredInfo] = React.useState({})
47+
const [filteredInfo, setFilteredInfo] = React.useState({bits:["true"]})
4848
const [sortedInfo, setSortedInfo] = React.useState({})
4949
const [animateColumn, setAnimateColumn] = React.useState(false)
5050

@@ -128,6 +128,7 @@ function OptimizerView({worlds, encyclopedia, golem}) {
128128
let columns = [{
129129
title: 'Ingredients to mix',
130130
dataIndex: 'ingredients',
131+
key: 'ingredients',
131132
render: ings => <>
132133
<div style={{display: "inline-block"}}><MyIcon imageDir="ingredients" name={ingredients[ings[0]]}/></div>
133134
<div style={{display: "inline-block"}}><MyIcon imageDir="ingredients" name={ingredients[ings[1]]}/></div>
@@ -139,20 +140,23 @@ function OptimizerView({worlds, encyclopedia, golem}) {
139140
}, {
140141
title: 'Starred theory chance',
141142
dataIndex: 'newCertainTheories',
143+
key: 'newCertainTheories',
142144
sorter: (a, b) => a.newCertainTheories - b.newCertainTheories,
143145
sortOrder: sortedInfo.columnKey === 'newCertainTheories' && sortedInfo.order,
144146
render: toPercentageString,
145147
width: 150,
146148
}, {
147149
title: 'Total theory chance',
148150
dataIndex: 'newTotalTheories',
151+
key: 'newTotalTheories',
149152
sorter: (a, b) => a.newTotalTheories - b.newTotalTheories,
150153
sortOrder: sortedInfo.columnKey === 'newTotalTheories' && sortedInfo.order,
151154
render: toPercentageString,
152155
width: 150,
153156
}, {
154157
title: 'Shannon entropy',
155158
dataIndex: 'bits',
159+
key: 'bits',
156160
sorter: (a, b) => a.bits - b.bits,
157161
sortOrder: sortedInfo.columnKey === 'bits' && sortedInfo.order,
158162
filters: [
@@ -165,6 +169,7 @@ function OptimizerView({worlds, encyclopedia, golem}) {
165169
}, {
166170
title: 'Mix Success',
167171
dataIndex: 'mixSuccess',
172+
key: 'mixSuccess',
168173
sorter: (a, b) => a.mixSuccess - b.mixSuccess,
169174
sortOrder: sortedInfo.columnKey === 'mixSuccess' && sortedInfo.order,
170175
filters: _.keys(potions).map((name, index) => ({text:<MyIcon imageDir="potions" name={name}/>, value:index})),
@@ -176,6 +181,7 @@ function OptimizerView({worlds, encyclopedia, golem}) {
176181
columns.push({
177182
title: 'Animate Success',
178183
dataIndex: 'animateSuccess',
184+
key: 'animateSuccess',
179185
sorter: (a, b) => a.animateSuccess - b.animateSuccess,
180186
sortOrder: sortedInfo.columnKey === 'animateSuccess' && sortedInfo.order,
181187
render: toPercentageString,

0 commit comments

Comments
 (0)