Skip to content

Commit 7db228a

Browse files
committed
fix:resolve relationship attribute update issues
1 parent c30c723 commit 7db228a

File tree

1 file changed

+9
-9
lines changed
  • src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes

1 file changed

+9
-9
lines changed

src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/attributes/relationship.svelte

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,13 @@
123123
// Reactive statements
124124
$: collections = collectionList?.collections?.filter((n) => n.$id !== $collection.$id) ?? [];
125125
126-
$: if (editing) {
126+
$: if (editing && data.twoWay !== undefined) {
127127
way = data.twoWay ? 'two' : 'one';
128-
} else {
129-
if (way === 'two') {
130-
data.twoWay = true;
131-
if (!data.twoWayKey) {
132-
data.twoWayKey = camelize($collection.name);
133-
}
134-
} else {
135-
data.twoWay = false;
128+
}
129+
$: if (!editing && way) {
130+
data.twoWay = way === 'two';
131+
if (way === 'two' && !data.twoWayKey) {
132+
data.twoWayKey = camelize($collection.name);
136133
}
137134
}
138135
@@ -158,6 +155,7 @@
158155
bind:group={way}
159156
name="one"
160157
value="one"
158+
disabled={editing}
161159
icon={IconArrowSmRight}>
162160
One Relation attribute within this collection
163161
</Card.Selector>
@@ -166,6 +164,7 @@
166164
bind:group={way}
167165
name="two"
168166
value="two"
167+
disabled={editing}
169168
icon={IconSwitchHorizontal}>
170169
One Relation attribute within this collection and another within the related collection
171170
</Card.Selector>
@@ -178,6 +177,7 @@
178177
placeholder="Select a collection"
179178
bind:value={data.relatedCollection}
180179
on:change={updateKeyName}
180+
disabled={editing}
181181
options={collections?.map((n) => ({ value: n.$id, label: `${n.name} (${n.$id})` })) ?? []} />
182182

183183
{#if data?.relatedCollection}

0 commit comments

Comments
 (0)