Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

254
Visualizações
Dnd-kit: active item loses order when dragged on Droppable

I'm facing a problem using @dnd-kit. The soring part works well (for example when I start dragging 1st element it obvioeulsy does sort), but when I reach a droppable element (green Thrash), the sorting breaks and the 1st element goes back.

You can see live demo here: link

Is there any way to fix this?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The problem was in handlers. When a dragged item reaches outside of the original drop area (a list), there is no more over-item under it. This is when the dragOver handler used to crash, since it relies on over.id internally

Solution: https://codesandbox.io/s/dndkit-grid-with-drag-handle-example-forked-w4j3sn

  1. Added checks for null and for id match
  2. Moved deletion logic to dragEnd handler
  3. Added state for dragged item reaching trash, so that list item can reflect it (becomes hidden)
  4. List item is hidden when dragged + new prop is true
  5. Moved Trash component out of original one, not critical tho
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda