Skip to content

Commit 1618d4a

Browse files
committed
compare id
1 parent 2fd3f3e commit 1618d4a

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

special-pages/pages/new-tab/app/favorites/components/PragmaticDND.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,19 @@ function useGridState(favorites, itemsDidReOrder, instanceId) {
9595
}
9696

9797
const destinationSrc = target.data.url;
98-
const startSrc = source.data.url;
98+
const destinationId = target.data.id;
9999
const startId = source.data.id;
100100

101101
if (typeof startId !== 'string') {
102-
return console.warn('could not access the id');
102+
return console.warn('could not access startId');
103103
}
104104

105105
if (typeof destinationSrc !== 'string') {
106106
return console.warn('could not access the destinationSrc');
107107
}
108108

109-
if (typeof startSrc !== 'string') {
110-
return console.warn('could not access the startSrc');
111-
}
112-
113-
const startIndex = favorites.findIndex((item) => item.url === startSrc);
114-
let indexOfTarget = favorites.findIndex((item) => item.url === destinationSrc);
109+
const startIndex = favorites.findIndex((item) => item.id === startId);
110+
let indexOfTarget = favorites.findIndex((item) => item.id === destinationId);
115111

116112
if (indexOfTarget === -1 && destinationSrc.includes('PLACEHOLDER-URL')) {
117113
indexOfTarget = favorites.length;

0 commit comments

Comments
 (0)