- mixin useEffect: the order should be
- Start fetching
- Start rendering
- Finish fetching
- missing Suspense fallback
- not try to read user info before it loaded
I also add lazy reload component here.
# Step 1: Download schema types from supabase via download button in supabase dashboard `API Docs` or the script below | |
# https://supabase.com/docs/guides/api/rest/generating-types | |
npx supabase gen types typescript --project-id "$PROJECT_REF" --schema public > types/supabase.ts | |
# Step 2: Transform TS schema types to json | |
npx ts-json-schema-generator --path './supabase.ts' --type 'Database' -o "./supabase.js" | |
# Step 3: Copy `schema.definitions.Database.properties['public'].properties.Tables` value into https://jsoneditoronline.org/ | |
# Step 4: Applied custom transform function below: |
function firstUniqCharWithHashMap(str) { | |
const map = new Map(); | |
for (let i = 0; i < str.length; i++) { | |
const char = str.charAt(i); | |
if (!map.has(char)) { | |
map.set(char, [i, 1]); | |
} else { | |
map.set(char, [i, map.get(char) + 1]); | |
} |