DanMossa
04/02/2022, 8:04 PMleviwhalen
04/02/2022, 8:34 PMBen-jam-in
04/03/2022, 5:40 AMkleak
04/03/2022, 6:48 AMhero76
04/03/2022, 8:14 AMhero76
04/03/2022, 8:14 AMhero76
04/03/2022, 8:16 AMankitzm
04/03/2022, 1:27 PMBen-jam-in
04/03/2022, 3:37 PMsbr
04/03/2022, 8:54 PMonAuthStateChange
trigger in all open tabs when the user logs in via a magic link in a different tab? It seems like https://github.com/supabase/supabase/issues/2739 fixed this but it doesn't seem to work for me?sbr
04/03/2022, 8:56 PMuseEffect(() => {
supabaseClient.auth.onAuthStateChange((event, session) => {
if (event === "SIGNED_IN") {
supabaseClient.auth.api
.getUser(session.access_token)
.then(({ user, error }) => {
if (user) {
setUser(user);
}
});
} else if (event === "SIGNED_OUT") {
setUser(null);
}
});
}, []);
sbr
04/04/2022, 8:52 AMOlyno
04/04/2022, 8:53 AM`7antra
04/04/2022, 4:14 PMOlyno
04/04/2022, 4:24 PMJaaneek
04/05/2022, 12:00 PMPerfectó
04/05/2022, 1:39 PMsameSite
attribute (while setting cookies) set to something else like none
? I'm not using gotrue api
garyaustin
04/05/2022, 2:38 PMcdedreuille
04/05/2022, 5:56 PMbill92
04/05/2022, 6:13 PMjonny
04/05/2022, 7:04 PMBicijay
04/05/2022, 7:23 PMJaaneek
04/05/2022, 8:32 PMts
const { data, error } = await supabase.storage
.from(storageBucketsNames.portfolioFiles)
.upload(`something/avatar`, file, { upsert: true });
if (error) return { error };
typeof data // { Key: string; } | null
Why is data nullable?Jaaneek
04/05/2022, 8:32 PMbarry
04/05/2022, 9:35 PMhaz
04/05/2022, 9:38 PMJaaneek
04/05/2022, 9:49 PMts
{Key:string}
instead it infers it to be:
ts
{ Key: string } | null
Me and my friend researched this further and came to conclusion that almost all of the storage methods are wrongly typed, they are being cast wrongly. We think its due to typescript version 4.07 which is bugged, we will make pull request and ask you to update typescript version aswell.
This is the bug we are talking about : https://github.com/microsoft/TypeScript/issues/48037
This is example of wrongly typed method in the storage library:
ts
getPublicUrl(
path: string
): {
data: { publicURL: string } | null
error: Error | null
publicURL: string | null
} {
try {
const _path = this._getFinalPath(path)
const publicURL = `${this.url}/object/public/${_path}`
const data = { publicURL }
return { data, error: null, publicURL }
} catch (error) {
return { data: null, error, publicURL: null }
}
}
Is typed as:
ts
{
data: { publicURL: string } | null
error: Error | null
publicURL: string | null
}
But should be:
ts
{
data: null;
error: Error;
publicURL: null;
}
| {
data: { publicURL: string };
error: null;
publicURL: string;
};
This is a huge inconvenience for users of this library and requires people that want to use typescript correctly to write a lot of boilerplate.barry
04/05/2022, 9:50 PM