Repository: PixiEditor/PixiEditor
File: src/PixiEditor/Models/DocumentModels/UpdateableChangeExecutors/MagicWandToolExecutor.cs (C#)

Code before:

    public override ExecutionState Start()
    {
        var magicWand = GetHandler<IMagicWandToolHandler>();
        var members = document!.ExtractSelectedLayers(true).ToList();

        if (magicWand is null || members.Count == 0)
            return ExecutionState.Error;

        mode = magicWand.ResultingSelectionMode;
        memberGuids = members;
        considerAllLayers = magicWand.DocumentScope == DocumentScope.Canvas;
        if (considerAllLayers)
            memberGuids = document!.StructureHelper.GetAllLayers().Select(x => x.Id).ToList();
        var pos = controller!.LastPixelPosition;
        tolerance = (float)magicWand.Tolerance;

        AddUpdateAction(pos);

        return ExecutionState.Success;
    }

    public override void OnPixelPositionChange(VecI pos)
    {
        AddUpdateAction(pos);
        internals!.ActionAccumulator.AddActions(new ChangeBoundary_Action());
    }

    public override void OnLeftMouseButtonUp(VecD argsPositionOnCanvas)
    {
        AddFinishAction();
        internals!.ActionAccumulator.AddActions(new ChangeBoundary_Action());
        onEnded!(this);
    }

    public override void ForceStop()
    {
        AddFinishAction();
        internals!.ActionAccumulator.AddActions(new ChangeBoundary_Action());
    }

    private void AddUpdateAction(VecI pos)
    {
        var action = new MagicWand_Action(memberGuids, pos, mode, tolerance, document!.AnimationHandler.ActiveFrameBindable);
        internals!.ActionAccumulator.AddActions(action);
    }
    private void AddFinishAction()
    {
        internals!.ActionAccumulator.AddActions(new EndMagicWand_Action());
    }
}

Review comment (suggestion):
Do not use `ChangeBoundary_Action`, use `AddFinishedActions` instead. Although I don't think it should be finished here. One user drag should be considered one undo change in that case imo. 

You've correctly made MagicWand an `UpdateableChange`, so multiple changes are part of one change. If you change boundary on each movement, you remove the benefit of using `UpdateableChange`

Code after:

    public override ExecutionState Start()
    {
        var magicWand = GetHandler<IMagicWandToolHandler>();
        var members = document!.ExtractSelectedLayers(true).ToList();

        if (magicWand is null || members.Count == 0)
            return ExecutionState.Error;

        mode = magicWand.ResultingSelectionMode;
        memberGuids = members;
        considerAllLayers = magicWand.DocumentScope == DocumentScope.Canvas;
        if (considerAllLayers)
            memberGuids = document!.StructureHelper.GetAllLayers().Select(x => x.Id).ToList();
        var pos = controller!.LastPixelPosition;
        tolerance = (float)magicWand.Tolerance;

        AddUpdateAction(pos);

        return ExecutionState.Success;
    }

    public override void OnPixelPositionChange(VecI pos)
    {
        AddUpdateAction(pos);
    }

    public override void OnLeftMouseButtonUp(VecD argsPositionOnCanvas)
    {
        AddFinishAction();
        onEnded!(this);
    }

    public override void ForceStop()
    {
        AddFinishAction();
    }

    private void AddUpdateAction(VecI pos)
    {
        var action = new MagicWand_Action(memberGuids, pos, mode, tolerance, document!.AnimationHandler.ActiveFrameBindable);
        internals!.ActionAccumulator.AddActions(action);
    }
    private void AddFinishAction()
    {
        internals!.ActionAccumulator.AddFinishedActions(new EndMagicWand_Action());
    }
}