chore(realtime): update docs for pg changes filter#46404
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
6 Skipped Deployments
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
📝 WalkthroughWalkthroughDocumentation updates to explain Postgres filter combination behavior and protocol-level filter field echoing. The Postgres Changes guide adds a "Combining filters (AND)" section with JavaScript, Dart, Kotlin, and Python examples showing comma-separated filters as logical AND. The Realtime Protocol guide expands filter documentation and documents the ChangesRealtime filter documentation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/docs/content/guides/realtime/protocol.mdx (1)
530-550:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winExample JSON missing the
filterfield added to the type definition.The type definition at line 515 includes
filter: stringin thepostgres_changesresponse object, and line 526 documents that it's echoed from the request. However, the example JSON at lines 539-545 doesn't include afilterfield, creating a mismatch between the documented type and the example.Add the
filterfield to the example (e.g.,"filter": "id=eq.1"or"filter": ""if none was specified).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/docs/content/guides/realtime/protocol.mdx` around lines 530 - 550, The example JSON for the "realtime:chat-room" phx_reply currently omits the postgres_changes.filter property declared in the type definition; update the example array so each object inside "postgres_changes" includes a "filter" string (e.g., "filter": "id=eq.1" or "filter": "") to match the documented type and the note that the filter is echoed from the request.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/docs/content/guides/realtime/postgres-changes.mdx`:
- Around line 993-1014: Update the Dart example under onPostgresChanges to show
using the rawFilter parameter for AND composition instead of
PostgresChangeFilter; replace the PostgresChangeFilter block in the
supabase.channel('changes').onPostgresChanges(...) call with a rawFilter string
that encodes both conditions (e.g., "quantity=gt.10,quantity=lt.100") and keep
the rest (callback, subscribe) unchanged so the example demonstrates the
documented AND filter behavior with rawFilter.
---
Outside diff comments:
In `@apps/docs/content/guides/realtime/protocol.mdx`:
- Around line 530-550: The example JSON for the "realtime:chat-room" phx_reply
currently omits the postgres_changes.filter property declared in the type
definition; update the example array so each object inside "postgres_changes"
includes a "filter" string (e.g., "filter": "id=eq.1" or "filter": "") to match
the documented type and the note that the filter is echoed from the request.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: 9066dfea-dc9f-4952-b8ac-fcdb55095b8e
📒 Files selected for processing (2)
apps/docs/content/guides/realtime/postgres-changes.mdxapps/docs/content/guides/realtime/protocol.mdx
| ```dart | ||
| supabase | ||
| .channel('changes') | ||
| .onPostgresChanges( | ||
| event: PostgresChangeEvent.insert, | ||
| schema: 'public', | ||
| table: 'products', | ||
| filter: PostgresChangeFilter( | ||
| type: PostgresChangeFilterType.gt, | ||
| column: 'quantity', | ||
| value: 10, | ||
| ), | ||
| callback: (payload) => print(payload)) | ||
| .subscribe(); | ||
| ``` | ||
|
|
||
| <Admonition type="note"> | ||
|
|
||
| Dart SDK does not support AND filter composition directly in `PostgresChangeFilter`. Pass the raw filter string via the `rawFilter` parameter instead. | ||
|
|
||
| </Admonition> | ||
|
|
There was a problem hiding this comment.
Dart example doesn't demonstrate the AND filtering described in this section.
The example shows a single PostgresChangeFilter with only quantity > 10, then the admonition states that Dart doesn't support AND composition and users should use rawFilter instead—but no example shows how to use rawFilter to achieve the AND logic (quantity=gt.10,quantity=lt.100) that this section is documenting.
Add a corrected Dart example showing rawFilter with the comma-separated AND filter string.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/docs/content/guides/realtime/postgres-changes.mdx` around lines 993 -
1014, Update the Dart example under onPostgresChanges to show using the
rawFilter parameter for AND composition instead of PostgresChangeFilter; replace
the PostgresChangeFilter block in the
supabase.channel('changes').onPostgresChanges(...) call with a rawFilter string
that encodes both conditions (e.g., "quantity=gt.10,quantity=lt.100") and keep
the rest (callback, subscribe) unchanged so the example demonstrates the
documented AND filter behavior with rawFilter.
I have read the CONTRIBUTING.md file.
YES
What kind of change does this PR introduce?
Update docs about the
andfilter on pg changesSummary by CodeRabbit