Skip to content

Undo move-task when moving to a different branch doesn't work #27

Description

@bprucha

When executing the undo action after a move-task action that moves the task from one branch to another, the task doesn't end up back under the original branch as expected.

I am currently experimenting with the pro features using the trial version if that makes any difference.

In the below example task 22 ("Task") should be back under task 47 ("[1] Master project")

import { Gantt, Toolbar, Willow, type IApi } from "@svar-ui/trial-react-gantt";
import './App.css'
import "@svar-ui/trial-react-gantt/all.css"; //import styles
import { useState } from "react";

function App() {
  const [api, setApi] = useState<IApi>();
  const tasks = [
    {
      id: 20,
      text: "New Task",
      start: new Date(2024, 5, 11),
      end: new Date(2024, 6, 12),
      duration: 1,
      progress: 2,
      type: "task",
      lazy: false,
    },
    {
      id: 47,
      text: "[1] Master project",
      start: new Date(2024, 5, 12),
      end: new Date(2024, 7, 12),
      duration: 8,
      progress: 0,
      parent: 0,
      type: "summary",
    },
    {
      id: 22,
      text: "Task",
      start: new Date(2024, 7, 11),
      end: new Date(2024, 8, 12),
      duration: 8,
      progress: 0,
      parent: 47,
      type: "task",
    },
    {
      id: 21,
      text: "New Task 2",
      start: new Date(2024, 7, 10),
      end: new Date(2024, 8, 12),
      duration: 3,
      progress: 0,
      type: "task",
      lazy: false,
    },
  ];

  const links = [{ id: 1, source: 20, target: 21, type: "e2e" }];

  const scales = [
    { unit: "month", step: 1, format: "%F %Y" },
    { unit: "day", step: 1, format: "%j" },
  ];

  function init(api: IApi) {
    setApi(api);

    api.exec("move-task", {id: 22, target: 47, mode: "before"});
    api.exec("undo");
  }

  return (
    <Willow>
      <Toolbar api={api} />
      <Gantt wbs undo tasks={tasks} links={links} scales={scales} init={init} />
    </Willow>
  )
}

export default App

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions