Skip to content

Commit 4b7e647

Browse files
committed
fix remove sequence item
1 parent e4c117e commit 4b7e647

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/components/Document/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import ArrowToMouse from "../ArrowToMouse"
1212
import { useTimeout, useWindowSize } from "react-use"
1313
import SequenceItem from "../SequenceItem"
1414
import classNames from "classnames"
15+
import stringToSequence from "../../string-to-sequence"
1516
import useEventCallback from "use-event-callback"
1617

1718
const Container = styled("div")(({ relationshipsOn }) => ({
@@ -82,7 +83,15 @@ export default function Document({
8283
highlightedItems.push(i)
8384
}
8485

85-
const onRemoveLabel = useEventCallback(sequenceItemIndex => {})
86+
const onRemoveLabel = useEventCallback(sequenceItemIndex => {
87+
onSequenceChange(
88+
sequence
89+
.flatMap((s, i) =>
90+
i !== sequenceItemIndex ? s : stringToSequence(s.text)
91+
)
92+
.filter(s => s.text.length > 0)
93+
)
94+
})
8695

8796
return (
8897
<Container

src/components/SequenceItem/index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,6 @@ export const SequenceItem = ({
141141
onClick={e => {
142142
e.stopPropagation()
143143
onRemoveLabel(sequenceItemIndex)
144-
// onSequenceChange(
145-
// sequence
146-
// .flatMap(s => (s !== seq ? s : stringToSequence(s.text)))
147-
// .filter(s => s.text.length > 0)
148-
// )
149144
}}
150145
>
151146
<span></span>

0 commit comments

Comments
 (0)