Skip to content

Commit f52add1

Browse files
committed
dumb little bug in task list drag-n-drop fix.
1 parent 6a46f47 commit f52add1

File tree

1 file changed

+4
-2
lines changed
  • src/packages/frontend/editors/task-editor

1 file changed

+4
-2
lines changed

src/packages/frontend/editors/task-editor/list.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export default function TaskList({
7070
const virtuosoRef = useRef<VirtuosoHandle>(null);
7171
const [visible, setVisible] = useState<List<string>>(visible0);
7272
useEffect(() => {
73-
setVisible(visible);
73+
setVisible(visible0);
7474
}, [visible0]);
7575

7676
const selectedHashtags: Set<string> = useMemo(() => {
@@ -174,7 +174,9 @@ export default function TaskList({
174174
let visible1 = visible.delete(oldIndex);
175175
visible1 = visible1.insert(newIndex, visible.get(oldIndex)!);
176176
setVisible(visible1);
177-
actions?.reorder_tasks(oldIndex, newIndex);
177+
// must set visible0 (in the store) in next render loop, or the above
178+
// gets combined with this and there is flicker.
179+
setTimeout(() => actions?.reorder_tasks(oldIndex, newIndex), 1);
178180
}}
179181
>
180182
<div

0 commit comments

Comments
 (0)