Skip to content

Avoid duplicate notification fetches across deferred children. #265

Description

@SillyCoon

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Avoid duplicate notification fetches across deferred children.

<Badge server:defer /> and <NotificationsList server:defer /> each fetch notifications independently in their own components, so one header render causes two reads against the same action/discourse source. Fetch once in the parent and pass the data down (or collapse into one deferred component).

🤖 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 `@src/components/notification/Notifications.astro` around lines 16 - 25, The
Badge and NotificationsList components are each fetching notifications
independently using server:defer, causing duplicate reads from the same source.
Fetch notifications once in the parent Notifications.astro component and pass
the fetched data down to both Badge and NotificationsList as props instead of
having them fetch separately. Remove or adjust the server:defer directives on
these child components so they consume the passed data rather than triggering
independent fetches.

Originally posted by @coderabbitai[bot] in #264 (comment)

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions