Skip to content

Refactor toggleReaction to Return a Consistent Object #6

@Silent-Watcher

Description

@Silent-Watcher

Improvement: Standardize toggleReaction Return Value

Description:
Currently, toggleReaction returns different object shapes ({removed: true}, {createdReaction}, {createdOrUpdated}). Refactor it to always return a consistent shape: { action: 'added' | 'removed', doc: ReactionDoc | null }.

Acceptance Criteria:

  • Return type is unified across both single and multi-reaction modes.
  • action property clearly indicates what occurred.
  • doc is null on removal, or the reaction document on add/update.
  • All existing tests are updated to reflect the new return value.
  • TypeScript definitions are updated.
  • Add usage examples in docs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions