Hello. I have one problem on update with svelte. W...
# help
j
Hello. I have one problem on update with svelte. When I update my "title" turns to ({"isTrusted":true}) (pic1) and the others columns don't update (pic2). My coce is (pic 3). I don't have any error on console. Any tips?
n
Hello @JR23! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
g
You need to look at your event handler code. In Svelte updatePost is going to get an event object as the parameter. You have to process that to get the data objects.
n
JR23 (2022-03-27)
j
thanks .. I'm will try to find out what to do (I have started to code not long ago ^^ )
g
change it to = async (e) and then console.log(e) to see the structure. I think the data is in target object, but not sure.
j
ok
I have this. I suppose that i must to target form?
g
You really need to go look at svelte form event docs. You might see more if you "open" the target >
j
a lot more. yeah. Well, I don't want to take your time. But thanks. (i'm feeling so noob .. ahaha)
fond the solution
this easy
😦
n
Thread was archived by @JR23. Anyone can send a message to unarchive it.
g
@User Ah. You had defined the variables upfront and binded them. So what you have now works. When you put those names as parameters in the function they got overwritten. Somewhere in e is also that same data, but you don't need it with the binds in this case.
j
@User yeah it was binded (that's why i didn't understand What you are saying, i thought you saw that ^^. I realise you didn't saw when you told me to see svelte doc .. xD ). But it was because of you that I found the problem . You really helped me.
*you were
thanks a lot
g
I have been using Svelte-Kit for a few months, but have not used binds (know what they are), and always use event handlers... Was not sure if Svelte was exactly the same though. And I was more focused on the Supabase call.
j
🙂 . What do you think of svelte?
g
I like it much better than React which I was using. Just seems to make more sense coming from strictly using javascript only in the past.
j
Ok. I'm really new in this "dev world" but I really liked svelte because the way we write code. It makes so much sense. Html, Css, JS and not JSX
I have another problem now. Lol. When RLS enable, update don't work
I have this (pic), its supabase default
maybe user.auth = user?
g
No idea what you are doing there.... normally for user id use auth.uid() = id_col (what ever it is) or auth.email() = 'fullemailname'
j
ok.
g
Normal steps to check RLS are policy (true) just to see if it works, then (auth.uid() = id) to make sure user can access table with an id row with uuid in it. You have to be signed in for that to work. If you think you are signed in and it does not work, then (auth.role() = 'anon') ... if that works then you are not actually signed it, but calling the client correctly... It is important if you use uid() that you actually have a uuid row in the table.
j
I'm signed in .. I think its only the rule that supabase created by default its not good
g
It does not create a policy by default
j
Its the template I should say
this
^^
g
Normally use the 4th one for matching uuid of user to uuid in your table.
j
well I have work to do
^^
g
Your table has to have a column to match on.
j
yes
I understood with the error
g
It is rare to use email policy as email can change. Usually a special case.
j
yep .. I have made with uid
going to see if it works
^^
Worked
its good .. I'm really starting to love supabase
xD