Skip to content

Commit 22be701

Browse files
committed
fix: ensure card id attributes are always present for drag operations
1 parent e397cda commit 22be701

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

resources/dist/flowforge.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/flowforge.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,23 @@ export default function flowforge({state}) {
1515

1616
handleSortableEnd(event) {
1717
const newOrder = event.to.sortable.toArray();
18-
const cardId = event.item.getAttribute('x-sortable-item');
18+
let cardId = event.item.getAttribute('x-sortable-item');
19+
20+
// Fallback to data-card-id if x-sortable-item is missing (edge case safety)
21+
if (!cardId) {
22+
cardId = event.item.getAttribute('data-card-id');
23+
if (!cardId) {
24+
console.error('Flowforge: Could not determine card ID for move operation');
25+
return;
26+
}
27+
}
28+
1929
const targetColumn = event.to.getAttribute('data-column-id');
30+
if (!targetColumn) {
31+
console.error('Flowforge: Target column ID is missing');
32+
return;
33+
}
34+
2035
const cardElement = event.item;
2136

2237
this.setCardState(cardElement, true);

resources/views/livewire/card.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
'cursor-grab hover:cursor-grabbing' => $hasPositionIdentifier,
1717
'cursor-default' => !$hasActions && !$hasCardAction && !$hasPositionIdentifier,
1818
])
19+
x-sortable-item="{{ $record['id'] }}"
20+
data-card-id="{{ $record['id'] }}"
1921
@if($hasPositionIdentifier)
2022
x-sortable-handle
21-
x-sortable-item="{{ $record['id'] }}"
2223
@endif
23-
data-card-id="{{ $record['id'] }}"
2424
data-position="{{ $record['position'] ?? '' }}"
2525
>
2626
<div class="flowforge-card-content">

0 commit comments

Comments
 (0)