Skip to content

Commit

Permalink
fix(editor): 🐛 Fix edge on item offset top on drop
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Mar 28, 2022
1 parent 43fa411 commit c64afb7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ export const ItemNodesList = ({
if (!isDraggingOnCurrentBlock) return
const itemIndex = computeNearestPlaceholderIndex(e.pageY, placeholderRefs)
e.stopPropagation()
setDraggedItem(undefined)
createItem(draggedItem as ButtonItem, {
blockIndex,
stepIndex,
itemIndex,
})
setDraggedItem(undefined)
}
useEventListener(
'mouseup',
Expand Down
5 changes: 2 additions & 3 deletions apps/builder/contexts/TypebotContext/actions/steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,8 @@ const moveStepToBlock = (
const items = stepHasItems(step) ? step.items : []
items.forEach((item) => {
const edgeIndex = typebot.edges.findIndex(byId(item.outgoingEdgeId))
edgeIndex !== -1
? (typebot.edges[edgeIndex].from.blockId = blockId)
: (newStep.outgoingEdgeId = undefined)
if (edgeIndex === -1) return
typebot.edges[edgeIndex].from.blockId = blockId
})
if (step.outgoingEdgeId) {
if (typebot.blocks[blockIndex].steps.length > stepIndex ?? 0) {
Expand Down

2 comments on commit c64afb7

@vercel
Copy link

@vercel vercel bot commented on c64afb7 Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on c64afb7 Mar 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

app.typebot.io
builder-v2-git-main-typebot-io.vercel.app
builder-v2-typebot-io.vercel.app

Please sign in to comment.