Skip to content

bug: cancelling a published document like is not persisted #59

Description

@PeterGuy326

Problem

On a published document, cancelling a like reports success and reduces the displayed count optimistically, but does not persist the decrement. Reloading restores the higher count.

Reproduction

Use a disposable local database and a synthetic published document:

  1. Record the initial count N.
  2. Like the document and wait for the increase request to succeed; the count is N + 1.
  3. Click again to cancel and wait for the decrease request to succeed; the interface shows N.
  4. Reload the page: the count is N + 1.

This was observed during local appearance acceptance, with all writes confined to an isolated test environment.

Source evidence

  • src/app/api/pub/thumb-up-decrease/[publishId]/route.ts:6 returns success unconditionally; the database decrement beginning at line 15 is commented out.
  • src/components/thumb-up-button.tsx:28 reduces the displayed count optimistically and calls the decrease endpoint at line 31.

These API lines already exist on main at 0d88ec4b94f6fdb669fad1db858058650eb8c76e. The appearance change tracked in #57 does not modify this endpoint.

Expected result

A successful cancellation should be reflected after reload, with an appropriate nonnegative count and consistent error handling. A future fix should include a persisted readback regression and explicitly define any identity or duplicate-cancellation behavior. No API change is included in the appearance PR.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions