Skip to content

Commit a016214

Browse files
authored
Merge pull request #2193 from HarshMN2345/fix-DAT-642-Bug-Updating-Relationships
Fix: bug updating relationships
2 parents 41f2574 + d22c39f commit a016214

File tree

1 file changed

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

1 file changed

+9
-10
lines changed

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,12 @@
123123
// Reactive statements
124124
$: collections = collectionList?.collections?.filter((n) => n.$id !== $collection.$id) ?? [];
125125
126-
$: if (editing) {
127-
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;
126+
$: if (!editing && way) {
127+
data.twoWay = way === 'two';
128+
if (way === 'two' && !data.twoWayKey) {
129+
data.twoWayKey = camelize($collection.name);
130+
} else if (way === 'one') {
131+
data.twoWayKey = undefined;
136132
}
137133
}
138134
@@ -158,6 +154,7 @@
158154
bind:group={way}
159155
name="one"
160156
value="one"
157+
disabled={editing}
161158
icon={IconArrowSmRight}>
162159
One Relation attribute within this collection
163160
</Card.Selector>
@@ -166,6 +163,7 @@
166163
bind:group={way}
167164
name="two"
168165
value="two"
166+
disabled={editing}
169167
icon={IconSwitchHorizontal}>
170168
One Relation attribute within this collection and another within the related collection
171169
</Card.Selector>
@@ -178,6 +176,7 @@
178176
placeholder="Select a collection"
179177
bind:value={data.relatedCollection}
180178
on:change={updateKeyName}
179+
disabled={editing}
181180
options={collections?.map((n) => ({ value: n.$id, label: `${n.name} (${n.$id})` })) ?? []} />
182181

183182
{#if data?.relatedCollection}

0 commit comments

Comments
 (0)