Skip to content

Consider Supabase Realtime instead of polling for notifications #7

Description

@malharlakdawala

The notification feed polls every 60 seconds (src/lib/use-notifications.ts). That is deliberate and cheap, but it means a comment can sit unseen for a minute, and every open tab queries the database on a timer all day.

Supabase Realtime could push these instead.

What to think about before building

This is not a straight win, so the investigation is part of the work:

  • The taskflow schema is not exposed to the Data API, and anon has no grants (supabase/migrations/20260727092031_taskflow_enable_rls.sql). Realtime would need that changed, which is a security decision, not a detail.
  • RLS on Notification already restricts rows to their recipient, which is the right foundation.
  • Polling should stay as a fallback for anyone who hasn't enabled Realtime.

Acceptance criteria

  • New notifications appear without a refresh, in under a second
  • Falls back to polling when Realtime is unavailable
  • No new data is exposed to the anon key — argue this explicitly in the PR
  • The badge stays correct across multiple open tabs

Worth commenting on the issue with your approach before writing much code.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestperformanceSpeed and payload size

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions