mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-14 16:51:33 +10:00
fix: Move and remove should match item by id
- Button does not respond to move and remove due to compare object instead of the id of the object
This commit is contained in:
@ -3,7 +3,7 @@ import html2canvas from 'html2canvas';
|
||||
import * as jsPDF from 'jspdf';
|
||||
|
||||
const move = (array, element, delta) => {
|
||||
const index = array.indexOf(element);
|
||||
const index = array.findIndex(item => item.id === element.id);
|
||||
const newIndex = index + delta;
|
||||
if (newIndex < 0 || newIndex === array.length) return;
|
||||
const indexes = [index, newIndex].sort((a, b) => a - b);
|
||||
|
||||
Reference in New Issue
Block a user