Skip to content

Commit f451db6

Browse files
feat(instructions): name is the default search field (#161)
1 parent 7b6f1e5 commit f451db6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/pages/InstructionsPage/InstructionsPage.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,14 @@ function InstructionsPage() {
9999
}, [anchorInstruction])
100100

101101
const toggleColumn = (key: InstructionColumnKey) => {
102-
setSearchColumns(prev => (prev.includes(key) ? prev.filter(k => k !== key) : [...prev, key]))
102+
setSearchColumns(prev => {
103+
if (prev.includes(key)) {
104+
const res = prev.filter(k => k !== key)
105+
return res.length === 0 ? ["name"] : res
106+
} else {
107+
return [...prev, key]
108+
}
109+
})
103110
}
104111

105112
const resetAnchor = () => {

0 commit comments

Comments
 (0)