code rabbit review of PR

This commit is contained in:
Pedro Rodrigues
2026-02-12 15:11:23 +00:00
parent 85ed94688e
commit 99cf30263d
4 changed files with 29 additions and 23 deletions

View File

@@ -12,19 +12,8 @@ metadata:
# Supabase # Supabase
Supabase is an open source Firebase alternative that provides a Postgres database, authentication, instant APIs, edge functions, realtime subscriptions, and storage. It's fully compatible with Postgres and works with any language, framework, or ORM. Supabase is an open source Firebase alternative that provides a Postgres database, authentication, instant APIs, edge functions, realtime subscriptions, and storage. It's fully compatible with Postgres and provides several language sdks, including supabase-js and supabase-py.
## Supabase Documentation
Always reference the Supabase documentation before making Supabase-related claims. The documentation is the source of truth for all Supabase-related information.
You can use the `curl` commands to fetch the documentation page as markdown:
**Documentation:**
```bash
# Fetch any doc page as markdown
curl -H "Accept: text/markdown" https://supabase.com/docs/<path>
``` ```
## Overview of Resources ## Overview of Resources
@@ -53,3 +42,19 @@ Reference the appropriate resource file based on the user's needs:
| Patterns | `references/realtime-patterns-*.md` | Cleanup, error handling, React integration | | Patterns | `references/realtime-patterns-*.md` | Cleanup, error handling, React integration |
**CLI Usage:** Always use `npx supabase` instead of `supabase` for version consistency across team members. **CLI Usage:** Always use `npx supabase` instead of `supabase` for version consistency across team members.
## Supabase Documentation
Everytime something is not clear, or you want to double-check something, reference the official Supabase documentation. It is the source of truth for all things Supabase and is regularly updated with the latest information, best practices, and examples. - [Supabase Documentation](https://supabase.com/docs). The documentation is available in html format on the website, but you can also fetch plain text versions of specific sections using the following endpoints:
**Documentation:**
```bash
# Index of all available docs
curl https://supabase.com/llms.txt
# Fetch all guides as plain text
curl https://supabase.com/llms/guides.txt
# Fetch JavaScript SDK reference
curl https://supabase.com/llms/js.txt

View File

@@ -44,15 +44,14 @@ channel.subscribe((status, err) => {
| Error | Cause | Solution | | Error | Cause | Solution |
|-------|-------|----------| |-------|-------|----------|
| `too_many_connections` | Connection limit exceeded | Clean up unused channels, upgrade plan | | `ConnectionRateLimitReached` | Connection limit exceeded | Clean up unused channels, upgrade plan |
| `too_many_channels` | Too many channels per connection | Remove unused channels (limit: 100/connection) | | `ChannelRateLimitReached` | Too many channels per connection | Remove unused channels (limit: 100/connection) |
| `too_many_joins` | Channel join rate exceeded | Reduce join frequency | | `ClientJoinRateLimitReached` | Channel join rate exceeded | Reduce join frequency |
| `tenant_events` | Too many messages/second | Reduce message rate or upgrade plan |
| `TenantNotFound` | Invalid project reference | Verify project URL | | `TenantNotFound` | Invalid project reference | Verify project URL |
## Automatic Reconnection ## Automatic Reconnection
Supabase handles reconnection automatically with exponential backoff. No manual re-subscribe is needed. Supabase handles reconnection automatically with exponential backoff (1s, 2s, 5s, 10s). No manual re-subscribe is needed for standard disconnects. For silent disconnections in backgrounded apps, use `heartbeatCallback` to detect and trigger reconnection (see below).
## Client-Side Logging ## Client-Side Logging
@@ -81,9 +80,9 @@ const supabase = createClient(url, key, {
// 1. Use Web Worker to prevent browser throttling of heartbeats // 1. Use Web Worker to prevent browser throttling of heartbeats
worker: true, worker: true,
// 2. Detect disconnections and reconnect // 2. Detect disconnections and reconnect
heartbeatCallback: (client) => { heartbeatCallback: (status) => {
if (client.connectionState() === 'disconnected') { if (status === 'disconnected') {
client.connect() supabase.realtime.connect()
} }
}, },
}, },

View File

@@ -12,7 +12,7 @@ Postgres Changes streams database changes via logical replication. Note: **Broad
## When to Use Postgres Changes ## When to Use Postgres Changes
- Quick prototyping and development - Quick prototyping and development
- Low user counts (< 100 concurrent subscribers per table) - Low subscriber counts per table (each change triggers RLS checks for every subscriber, so performance degrades linearly)
- When simplicity is more important than scale - When simplicity is more important than scale
## Basic Setup ## Basic Setup

View File

@@ -79,8 +79,10 @@ const channel = supabase.channel('room:123', {
| Free | 20 | | Free | 20 |
| Pro | 50 | | Pro | 50 |
| Pro (no spend cap) | 1,000 | | Pro (no spend cap) | 1,000 |
| Team/Enterprise | 1,000 | | Team/Enterprise | 1,000+ |
For Pay as you go customers, stop and ask the user to edit these limits in the Supabase Dashboard under Realtime Settings.
Limits are configurable per project. Pro (no spend cap), Team, and Enterprise users can adjust limits in the Supabase Dashboard under Realtime Settings.
## Related ## Related
- [setup-channels.md](setup-channels.md) - [setup-channels.md](setup-channels.md)