mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 18:11:12 -05:00
Fix auto-refresh and queue claiming
This commit is contained in:
@@ -130,13 +130,22 @@ function hasItemChanged<T>(
|
||||
compareFields?: (keyof T)[]
|
||||
): boolean {
|
||||
if (!compareFields || compareFields.length === 0) {
|
||||
// Deep comparison if no specific fields provided
|
||||
return JSON.stringify(currentItem) !== JSON.stringify(newItem);
|
||||
// If no fields specified, assume no change (too sensitive to compare everything)
|
||||
// This prevents false positives from object reference changes
|
||||
return false;
|
||||
}
|
||||
|
||||
// Compare only specified fields
|
||||
for (const field of compareFields) {
|
||||
if (currentItem[field] !== newItem[field]) {
|
||||
const currentValue = currentItem[field];
|
||||
const newValue = newItem[field];
|
||||
|
||||
// Handle nested objects/arrays
|
||||
if (typeof currentValue === 'object' && typeof newValue === 'object') {
|
||||
if (JSON.stringify(currentValue) !== JSON.stringify(newValue)) {
|
||||
return true;
|
||||
}
|
||||
} else if (currentValue !== newValue) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user