Skip to content

Commit 8e3ad1e

Browse files
authored
Merge pull request #2830 from appwrite/fix-user-and-team-preferences-bug
fix: not able to add input to user and team preferences
2 parents 87eeb6f + ba63888 commit 8e3ad1e

2 files changed

Lines changed: 16 additions & 12 deletions

File tree

src/routes/(console)/project-[region]-[project]/auth/teams/team-[team]/updatePrefs.svelte

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
$: if (prefs) {
2424
const currentNormalized = normalizePrefs(prefs);
2525
const originalNormalized = normalizePrefs(
26-
Object.entries($team.prefs as Record<string, string>)
26+
Object.entries(($team?.prefs ?? {}) as Record<string, string>)
2727
);
2828
2929
arePrefsDisabled = deepEqual(currentNormalized, originalNormalized);
@@ -33,7 +33,7 @@
3333
let arePrefsDisabled = true;
3434
3535
onMount(async () => {
36-
const entries = Object.entries($team.prefs as Record<string, string>);
36+
const entries = Object.entries(($team?.prefs ?? {}) as Record<string, string>);
3737
prefs =
3838
entries.length > 0
3939
? entries.map(([key, value]) => createPrefRow(key, value))
@@ -81,8 +81,9 @@
8181
<Layout.Stack direction="row" alignItems="flex-end">
8282
<InputText
8383
id={`key-${index}`}
84-
bind:value={pref.key}
85-
on:input={() => {
84+
value={pref.key}
85+
on:input={(e) => {
86+
pref.key = (e.currentTarget as HTMLInputElement).value;
8687
prefs = [...prefs];
8788
}}
8889
placeholder="Enter key"
@@ -91,8 +92,9 @@
9192
<Layout.Stack direction="row" alignItems="flex-end" gap="xs">
9293
<InputText
9394
id={`value-${index}`}
94-
bind:value={pref.value}
95-
on:input={() => {
95+
value={pref.value}
96+
on:input={(e) => {
97+
pref.value = (e.currentTarget as HTMLInputElement).value;
9698
prefs = [...prefs];
9799
}}
98100
placeholder="Enter value"

src/routes/(console)/project-[region]-[project]/auth/user-[user]/updatePrefs.svelte

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
2323
$: if (prefs) {
2424
const currentNormalized = normalizePrefs(prefs);
25-
const originalNormalized = normalizePrefs(Object.entries($user.prefs));
25+
const originalNormalized = normalizePrefs(Object.entries($user?.prefs ?? {}));
2626
2727
arePrefsDisabled = deepEqual(currentNormalized, originalNormalized);
2828
}
@@ -31,7 +31,7 @@
3131
let arePrefsDisabled = true;
3232
3333
onMount(async () => {
34-
const entries = Object.entries($user.prefs);
34+
const entries = Object.entries($user?.prefs ?? {});
3535
prefs =
3636
entries.length > 0
3737
? entries.map(([key, value]) => createPrefRow(key, value))
@@ -78,8 +78,9 @@
7878
<Layout.Stack direction="row" alignItems="flex-end">
7979
<InputText
8080
id={`key-${index}`}
81-
bind:value={pref.key}
82-
on:input={() => {
81+
value={pref.key}
82+
on:input={(e) => {
83+
pref.key = (e.currentTarget as HTMLInputElement).value;
8384
prefs = [...prefs];
8485
}}
8586
placeholder="Enter key"
@@ -88,8 +89,9 @@
8889
<Layout.Stack direction="row" alignItems="flex-end" gap="xs">
8990
<InputText
9091
id={`value-${index}`}
91-
bind:value={pref.value}
92-
on:input={() => {
92+
value={pref.value}
93+
on:input={(e) => {
94+
pref.value = (e.currentTarget as HTMLInputElement).value;
9395
prefs = [...prefs];
9496
}}
9597
placeholder="Enter value"

0 commit comments

Comments
 (0)