mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fixed incorrect array being used in comparison
Use `symmetricDifference` instead of `difference`. - `difference` only returns values that are present in the edited attributes, but not in the originally fetched attribute vales. This always ends up returning an empty array. - I used `symmetricDifference` as it returns an intersection of `difference` from both sides and works perfectly for this use case, as the original attributes never change.
This commit is contained in:
+2
-2
@@ -13,7 +13,7 @@
|
||||
import { collection, type Attributes } from '../../store';
|
||||
import { Container } from '$lib/layout';
|
||||
import AttributeItem from '../attributeItem.svelte';
|
||||
import { difference, symmetricDifference } from '$lib/helpers/array';
|
||||
import { symmetricDifference } from '$lib/helpers/array';
|
||||
import { isRelationship, isRelationshipToMany } from '../attributes/store';
|
||||
|
||||
const databaseId = $page.params.database;
|
||||
@@ -77,7 +77,7 @@
|
||||
const docAttribute = $doc?.[attribute.key];
|
||||
|
||||
if (attribute.array) {
|
||||
return !difference(Array.from(workAttribute), Array.from(docAttribute)).length;
|
||||
return !symmetricDifference(Array.from(workAttribute), Array.from(docAttribute)).length;
|
||||
}
|
||||
|
||||
if (isRelationship(attribute)) {
|
||||
|
||||
Reference in New Issue
Block a user