Skip to content

**Bug:** The createRecipeRealtimeService() factory is never called, disabling real-time recipe updates. #1459

@marcuscastelo

Description

@marcuscastelo

Bug: The createRecipeRealtimeService() factory is never called, disabling real-time recipe updates.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The refactoring of the recipe module's realtime service changed initializeRecipeRealtime() from a direct export to an internal function within createRecipeRealtimeService(). However, createRecipeRealtimeService() is never instantiated or called, leading to initializeRecipeRealtime() never being executed. Consequently, the recipe realtime subscription is never established, preventing real-time updates (INSERT, UPDATE, DELETE) from Supabase from being processed, and causing users to see stale recipe data.

💡 Suggested Fix

Instantiate and call createRecipeRealtimeService() in the appropriate use-case file (e.g., recipeUseCases.ts) and then call initializeRecipeRealtime() from the returned service object, similar to other modules.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/modules/diet/recipe/infrastructure/supabase/realtime.ts#L7-L73

Potential issue: The refactoring of the recipe module's realtime service changed
`initializeRecipeRealtime()` from a direct export to an internal function within
`createRecipeRealtimeService()`. However, `createRecipeRealtimeService()` is never
instantiated or called, leading to `initializeRecipeRealtime()` never being executed.
Consequently, the recipe realtime subscription is never established, preventing
real-time updates (INSERT, UPDATE, DELETE) from Supabase from being processed, and
causing users to see stale recipe data.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 5958302

Originally posted by @sentry[bot] in #1457 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions