From deadb56aaa4b60a0e425e5127f1c4ebf333c9ea9 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Sat, 25 Oct 2025 23:00:25 +0200 Subject: [PATCH] Try to load profiles times if not found --- web/pages/[username]/index.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/web/pages/[username]/index.tsx b/web/pages/[username]/index.tsx index 09f92fb3..f5897ac5 100644 --- a/web/pages/[username]/index.tsx +++ b/web/pages/[username]/index.tsx @@ -18,6 +18,7 @@ import {getUserForStaticProps} from 'common/supabase/users' import {type GetStaticProps} from 'next' import {CompassLoadingIndicator} from "web/components/widgets/loading-indicator"; import Custom404 from '../404' +import {sleep} from "common/util/time"; export const getStaticProps: GetStaticProps< UserPageProps, @@ -63,7 +64,18 @@ export const getStaticProps: GetStaticProps< } } - const profile = await getProfileRow(user.id, db) + let profile + let i = 0 + while (!profile) { + profile = await getProfileRow(user.id, db) + if (i > 0) await sleep(500) + i++ + if (i >= 4) { + break + } + } + console.debug(`Profile loaded after ${i} tries`) + if (!profile) { console.debug('No profile', `${user.username} hasn't created a profile yet.`) return {