Skip to content

Commit 84b1c12

Browse files
authored
Merge pull request #587 from supabase/feat/release-v2
feat: Release v2
2 parents b364fb8 + e7deb3a commit 84b1c12

26 files changed

+19925
-5763
lines changed

--includes

Lines changed: 0 additions & 3967 deletions
This file was deleted.

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ jobs:
2626

2727
- run: |
2828
npm ci
29-
npm run v1:docs
30-
npm run v1:docs:json
29+
npm run docs
30+
npm run docs:json
3131
3232
- name: Publish
3333
uses: peaceiris/actions-gh-pages@v3

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,5 @@ dist
103103

104104
# TernJS port file
105105
.tern-port
106+
107+
docs/v2

docs/v2/.gitkeep

Whitespace-only changes.

example/next-storage/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ create policy "Users can update own profile."
3737
-- Set up Realtime!
3838
begin;
3939
drop publication if exists supabase_realtime;
40-
create publication supabase_realtime;
40+
create publication supabase_realtime for table profiles;
4141
commit;
42-
alter publication supabase_realtime add table profiles;
4342

4443
-- Set up Storage!
4544
insert into storage.buckets (id, name)

example/next-storage/components/Account.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ export default function Account({
3535
throw 'You must select an image to upload.'
3636
}
3737

38-
const user = supabase.auth.user()
38+
const { user } = await supabase.auth.getUser()
3939
const file = event.target.files[0]
4040
const fileExt = file.name.split('.').pop()
41-
const fileName = `${session?.user.id}${Math.random()}.${fileExt}`
41+
const fileName = `${session?.user?.id}${Math.random()}.${fileExt}`
4242
const filePath = `${fileName}`
4343

4444
let { error: uploadError } = await supabase.storage
@@ -127,7 +127,7 @@ export default function Account({
127127
<div className="account">
128128
<div>
129129
<label htmlFor="email">Email</label>
130-
<input id="email" type="text" value={session.user.email} disabled />
130+
<input id="email" type="text" value={session?.user?.email} disabled />
131131
</div>
132132
<div>
133133
<label htmlFor="username">Name</label>

example/next-storage/components/ProfileList.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
import ProfileCard from '../components/ProfileCard'
22
import { Profile } from '../lib/constants'
3-
import { Subscription, SupabaseRealtimePayload } from '@supabase/supabase-js'
43
import { supabase } from '../lib/api'
54
import { useState, useEffect } from 'react'
65

7-
var realtimeProfiles: Subscription | null = null
8-
96
export default function ProfileList() {
107
const [profiles, setProfiles] = useState<Profile[]>([])
118

129
useEffect(() => {
1310
// getPublicProfiles()
1411
getUserProfile()
1512

16-
realtimeProfiles = supabase
17-
.from('profiles')
18-
.on('*', (payload: SupabaseRealtimePayload<Profile>) => profileUpdated(profiles, payload.new))
13+
const realtimeProfiles = supabase
14+
.channel('public:profiles')
15+
.on(
16+
'postgres_changes',
17+
{ event: '*', schema: 'public', table: 'profiles' },
18+
(payload: { [key: string]: any }) => profileUpdated(profiles, payload.new)
19+
)
1920
.subscribe()
2021

2122
return () => {
22-
if (realtimeProfiles) supabase.removeSubscription(realtimeProfiles)
23+
if (realtimeProfiles) supabase.removeChannel(realtimeProfiles)
2324
}
2425
}, [])
2526

@@ -29,12 +30,12 @@ export default function ProfileList() {
2930
}
3031

3132
async function getUserProfile() {
32-
const user = supabase.auth.user()
33+
const { user } = await supabase.auth.getUser()
3334
try {
3435
const { data, error } = await supabase
3536
.from('profiles')
3637
.select('id, username, avatar_url, website, updated_at')
37-
.eq('id', user.id)
38+
.eq('id', user?.id)
3839
.order('updated_at', { ascending: false })
3940
if (error) {
4041
throw error

0 commit comments

Comments
 (0)