Skip to content

New bookmarks not appearing first when sorted by newest #2583

@The-Khan-Labs

Description

@The-Khan-Labs

Describe the Bug

When I save a new bookmark (from the browser extension or the web UI) and sort by "Newest first", the new bookmark does not appear at the top.

Refreshing the page does not fix it.

After debugging my self-hosted instance I found that some bookmarks are stored with createdAt in Unix seconds instead of milliseconds.

Example value stored:
1773238339

Correct millisecond timestamp example:
1773238379976

Because of this, bookmarks created with seconds timestamps sort far below the normal millisecond timestamps.

Database query used to confirm:

select id,title,createdAt
from bookmarks
order by createdAt desc;

I suspect the issue may be related to timestamp handling in:

packages/db/schema.ts
packages/shared/types/bookmarks.ts

Changing timestamp mode from timestamp to timestamp_ms appears to fix it.

Environment:
Self-hosted Karakeep (Docker)

Steps to Reproduce

  1. Save a new bookmark from the browser extension or web UI.
  2. Open the bookmarks page.
  3. Sort bookmarks by Newest first.
  4. The newly created bookmark does not appear at the top.
  5. Refreshing the page does not change the order.

Expected Behaviour

When a new bookmark is saved, it should appear at the top when sorting by Newest first.

Screenshots or Additional Context

No response

Device Details

No response

Exact Karakeep Version

Latest Docker image (ghcr.io/karakeep-app/karakeep:latest)

Environment Details

Docker

Debug Logs

No response

Have you checked the troubleshooting guide?

  • I have checked the troubleshooting guide and I haven't found a solution to my problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstatus/untriagedThis issue needs triaging to confirm it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions