Enon | USB
02/11/2023, 8:18 AMenyo
02/11/2023, 8:53 AM\p{L}
https://www.regular-expressions.info/unicode.html#category
This seems to not be supported by postgres.
I tried using it in a plv8 function instead but it also fails. (I assume that it's an older v8 version?)
Any tips?jinsley8
02/11/2023, 9:12 AMjs
function getPagination(page: number, size: number) {
const limit = size ? +size : 24;
const from = page ? page * limit : 0;
const to = page ? from + size - 1 : size - 1;
return { from, to };
}
Now my API route gets the new page number and size is set to 12. I have almost 60 items total in the database so I should get up to 5 pages.
js
const { from: fromIndex, to: toIndex } = getPagination(Number(page), Number(size));
const { data, error } = await supabase
.from('items')
.select('*')
.order('created_at', { ascending: false })
.range(Number(fromIndex), Number(toIndex));
On page load it loads the first 12 and is receiving page: 0, size: 12
and returning 12 items.
The next page load it get page: 2, size: 12
and returning 0 items. fromIndex = 24, toIndex = 35
. So it seems like it's skipping page 1 but should still be returning data but I only get an empty area after the initial page load.avalanche
02/11/2023, 9:48 AMdart
return supabase.client
.from('favourite')
.select('id,item(id)')
Xenni
02/11/2023, 11:25 AMgetUser()
which actually hits the /user
endpoint to retrieve an up to date profile. This was a little ambiguous in the docs and makes me wonder in which circumstances you would typically want it over getSession().data.session.user
.
Obviously if you're updating a user profile that could be relevant although theoretically their session would refresh relatively frequently and thus make it more of a non-issue. If the user is executing the update themselves rather than say an admin then we would simply call refreshSession
upon submission of the form too.
If this is something we want to improve I'd be happy to update the docs for getUser
to make the behaviour a little more explicit.Hugos
02/11/2023, 11:49 AMjson
[
{
"fen": "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
"from": null,
"to": null
},
{
"fen": "rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq d3 0 1",
"from": "e2",
"to": "e4"
}
]
Since an array is already defined with ``{}`` how can i mark this as an array? just surrounding it with an extra set of brackets does not seem to workAlaanor
02/11/2023, 1:05 PMA-PRYME
02/11/2023, 1:11 PMPost
, Comment
and User
. A post has a list of comments, and each comment belongs to a single user. How might I get a list of comments with their associated users as a stream? Say I want to build a reactive comment section where each comment is displayed together with the name and avatar of the user who wrote it. If a new comment is added
, liked
or removed
, the comment section should react accordingly.
I ask this because Supabase allow realtime queries for a single table only. This means I can't easily join my comment table with my user table.Jordy
02/11/2023, 1:28 PMmjs
02/11/2023, 2:56 PMn10000k
02/11/2023, 4:55 PMjfbn
02/11/2023, 5:08 PMauth.signUp
method to create a user.
Then I create another user shortly after, without logging into the first one.
Server throws the error:
Cannot use `cookies.set(...)` after the response has been generated
I'm not entirely sure what's happening here. Is the signUp
function setting cookies in the assumption that the user is meant to be logged in right away?Jarvis
02/11/2023, 5:28 PMShelby
02/11/2023, 5:45 PMavalanche
02/11/2023, 7:59 PMMarius.Dmn
02/11/2023, 8:02 PM.textSearch("ticker", `%${searchValue}%`, { type: "phrase" })
But it dosen't seem to work.
I'm looking for something like ->
Search for joh and return Johnnatannish
02/11/2023, 8:56 PMsupabase.auth.updateUser
to save data to user.user_metadata
, but this would save the information the database.
How can I save information to the current session? I am using Supabase with Sveltekit and the Sveltekit-auth if that helps.Ailer
02/11/2023, 9:12 PMMike!
02/11/2023, 9:12 PMrobertn702
02/11/2023, 9:34 PM1.48.158 Chromium: 110.0.5481.77 (Official Build) (arm64)
Running on: macOS Version 13.1 (Build 22C65)
NEXT_DATA buildId: Jj7sGp495Wuv0AhUMjHgF
Sarcodo
02/11/2023, 9:53 PMsupabase start
command, I'm using npm so the command I run specifically is npx supabase start
and I get the error shown in the image
Sorry if this is a vague question, not sure where to go from here as I can't see anything online for thisPeterP
02/11/2023, 11:36 PMBloxs
02/11/2023, 11:49 PMfailed to close prepared statement: ERROR: current transaction is aborted, commands ignored until end of transaction block (SQLSTATE 25P02): ERROR: duplicate key value violates unique constraint "users_email_partial_key" (SQLSTATE 23505)
but if I do it the other way around (log in with github first then discord) it works just fine. All auth related triggers are disabled.n10000k
02/11/2023, 11:53 PMsql
create or replace function public.update_balance()
returns trigger
language plpgsql
security definer
as $$
begin
select
cron.schedule(
new.id,
'* * * * *',
$$
select status from http_post(
'https://webhook.site/redacted',
'{"customer": "1"}',
'application/json'
)
$$
);
return new;
end;
$$;
returns:
syntax error at or near "select"
Any ideas? thanks in advancegaryaustin
02/12/2023, 12:59 AMzhay
02/12/2023, 1:20 AMElbyssal
02/12/2023, 1:22 AMconst createForumStore = () => {
const store = writable([]);
[...]
const addTopic = async (topic) => {
try {
store.update((topics) => [...topics, topic]);
await supabase.from('topics').insert({
title: topic.title
});
console.log('addTopic', topic);
} catch (error) {
console.error(error);
}
};
const removeTopic = async (topicId) => {
try {
store.update((topics) => topics.filter((t) => t.id !== topicId));
await supabase.from('topics').delete().eq('id', topicId);
console.log('removeTopic', topicId);
} catch (error) {
console.error(error);
}
};
const updateTopic = async (topic) => {
try {
store.update((topics) => {
const index = topics.findIndex((t) => t.id === topic.id);
console.log(topics)
return [...topics.slice(0, index), topic, ...topics.slice(index + 1)];
});
await supabase.from('topics').update(topic).eq('id', topic.id);
console.log('updateTopic', topic);
} catch (error) {
console.error(error);
}
};
It seems successful, returning an object with the correct id I see in supabase:
{id: 21, created_at: '2023-02-11T23:02:34.341067+00:00', title: 'updatedTopic', description: null, tags: null, …}
DYELbrah
02/12/2023, 1:41 AMLe0n
02/12/2023, 3:30 AMIstoraMandiri
02/12/2023, 5:20 AM