Skip to content

chore(realtime): update docs for pg changes filter#46404

Open
filipecabaco wants to merge 1 commit into
masterfrom
chore/update-docs-for-postgres-changes-real-827
Open

chore(realtime): update docs for pg changes filter#46404
filipecabaco wants to merge 1 commit into
masterfrom
chore/update-docs-for-postgres-changes-real-827

Conversation

@filipecabaco
Copy link
Copy Markdown
Member

@filipecabaco filipecabaco commented May 26, 2026

I have read the CONTRIBUTING.md file.

YES

What kind of change does this PR introduce?

Update docs about the and filter on pg changes

Summary by CodeRabbit

  • Documentation
    • Added guidance on combining multiple Postgres change filters using logical AND operators
    • Clarified filter parsing behavior and handling of empty filters
    • Updated Realtime Protocol documentation to include filter field specifications and cross-SDK examples

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment, Open in v0 May 26, 2026 8:15pm
6 Skipped Deployments
Project Deployment Actions Updated (UTC)
studio Ignored Ignored May 26, 2026 8:15pm
design-system Skipped Skipped May 26, 2026 8:15pm
studio-self-hosted Skipped Skipped May 26, 2026 8:15pm
studio-staging Skipped Skipped May 26, 2026 8:15pm
ui-library Skipped Skipped May 26, 2026 8:15pm
zone-www-dot-com Skipped Skipped Open in v0 May 26, 2026 8:15pm

Request Review

@supabase
Copy link
Copy Markdown

supabase Bot commented May 26, 2026

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 26, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

📝 Walkthrough

Walkthrough

Documentation 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 filter field echo in server responses.

Changes

Realtime filter documentation

Layer / File(s) Summary
Postgres Changes filter combination guide
apps/docs/content/guides/realtime/postgres-changes.mdx
New "Combining filters (AND)" section with multi-language examples (JavaScript, Dart, Kotlin, Python) showing how comma-separated filters apply logical AND. Includes clarifications on comma parsing inside in(...) expressions and behavior of empty/whitespace-only filters.
Protocol filter field documentation
apps/docs/content/guides/realtime/protocol.mdx
Updated phx_join documentation to expand filter option description with expression formats and parsing rules. Added filter: string field to phx_reply postgres_changes response structure and documented that this field echoes the request payload.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Filters dance in commas now,
AND logic docs take their bow,
Protocol echoes what you send,
A clearer path from start to end! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: updating documentation for PostgreSQL changes filters, which aligns with the actual content additions about combining filters (AND) in the guide and protocol documentation.
Description check ✅ Passed The description includes the required CONTRIBUTING.md confirmation and specifies the change type as documentation update about the AND filter, but lacks details about what specifically was documented or which files were updated.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/update-docs-for-postgres-changes-real-827

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Example JSON missing the filter field added to the type definition.

The type definition at line 515 includes filter: string in the postgres_changes response object, and line 526 documents that it's echoed from the request. However, the example JSON at lines 539-545 doesn't include a filter field, creating a mismatch between the documented type and the example.

Add the filter field 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

📥 Commits

Reviewing files that changed from the base of the PR and between 1c7af66 and ea84a44.

📒 Files selected for processing (2)
  • apps/docs/content/guides/realtime/postgres-changes.mdx
  • apps/docs/content/guides/realtime/protocol.mdx

Comment on lines +993 to +1014
```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>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants