mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: single relationship data editable
This commit is contained in:
1 parent
8131fce59b
commit
a58547e97d
3 files changed
+17
-10
No files matched your search
@@ -93,6 +93,7 @@
|
||||
value = null;
|
||||
!$$slots.output && (element.value = search);
|
||||
hasFocus = false;
|
||||
dispatch('reset');
|
||||
}
|
||||
|
||||
$: showClearBtn = (hasFocus && search) || value;
|
||||
|
||||
+10
-5
@@ -35,11 +35,15 @@
|
||||
await teamPrefs.load($organization.$id);
|
||||
documentList = await getDocuments();
|
||||
|
||||
if (editing && $doc?.[attribute.key] && $doc[attribute.key]?.length) {
|
||||
relatedList =
|
||||
$doc[attribute.key]?.map((d: Record<string, unknown>) => {
|
||||
return d?.$id;
|
||||
}) ?? [];
|
||||
if (editing && $doc?.[attribute.key]) {
|
||||
if ($doc[attribute.key]?.length) {
|
||||
relatedList =
|
||||
$doc[attribute.key]?.map((d: Record<string, unknown>) => {
|
||||
return d?.$id;
|
||||
}) ?? [];
|
||||
} else {
|
||||
singleRel = $doc[attribute.key]?.$id;
|
||||
}
|
||||
}
|
||||
|
||||
displayNames = $teamPrefs?.displayNames?.[attribute?.relatedCollection] ?? ['$id'];
|
||||
@@ -253,6 +257,7 @@
|
||||
bind:value={singleRel}
|
||||
{options}
|
||||
let:option={o}
|
||||
on:reset={() => (value = null)}
|
||||
on:select={() => (value = singleRel)}>
|
||||
<SelectSearchItem data={o.data}>
|
||||
{o.label}
|
||||
|
||||
+6
-5
@@ -94,13 +94,14 @@
|
||||
);
|
||||
return !symmetricDifference(workIds, relatedIds).length;
|
||||
} else {
|
||||
return workAttribute && docAttribute
|
||||
? !symmetricDifference(Array.from(workAttribute), Array.from(docAttribute))
|
||||
.length
|
||||
: true;
|
||||
const workId =
|
||||
typeof workAttribute === 'string' ? workAttribute : workAttribute?.$id;
|
||||
const relatedId =
|
||||
typeof docAttribute === 'string' ? docAttribute : docAttribute?.$id;
|
||||
|
||||
return workId === relatedId;
|
||||
}
|
||||
}
|
||||
|
||||
return workAttribute === docAttribute;
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user