Skip to content

Fix bookmark last visit time on Chrome#44

Merged
msmolens merged 1 commit intomainfrom
fix-chrome-last-visit-time
Oct 19, 2025
Merged

Fix bookmark last visit time on Chrome#44
msmolens merged 1 commit intomainfrom
fix-chrome-last-visit-time

Conversation

@msmolens
Copy link
Owner

The chrome.history.getVisits API behaves differently on different browsers: Firefox sorts the visits in reverse chronological order and Chrome sorts the visits in chronological order.

Update the HistoryManager to handle both cases. This fixes a bug on Chrome where a previously visited bookmark might not display in a larger font even if it's been visited recently.

See:

@msmolens msmolens marked this pull request as ready for review October 19, 2025 16:55
@msmolens msmolens requested a review from Copilot October 19, 2025 16:56
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a browser compatibility issue where bookmark last visit times were incorrectly calculated on Chrome due to different sorting behaviors between Chrome and Firefox in the chrome.history.getVisits API.

  • Adds a new getMostRecentItem function that handles both Chrome's chronological and Firefox's reverse chronological ordering
  • Updates the HistoryManager to use this function instead of assuming the first item is the most recent
  • Enhances test factories and test coverage to verify both browser ordering conventions

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/treetop/HistoryManager.ts Implements the core fix with getMostRecentItem function and updates all visit time calculations
test/utils/factories.ts Adds createVisitItems factory to generate test data with different browser ordering conventions
src/treetop/HistoryManager.test.ts Expands test coverage to verify both Chrome and Firefox ordering behaviors
CHANGELOG.md Documents the bug fix in the changelog

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

The `chrome.history.getVisits` API behaves differently on different
browsers: Firefox sorts the visits in reverse chronological order and
Chrome sorts the visits in chronological order.

Update the HistoryManager to handle both cases. This fixes a bug on
Chrome where a previously visited bookmark might not display in a larger
font even if it's been visited recently.
@msmolens msmolens force-pushed the fix-chrome-last-visit-time branch from c31a787 to 538b3e4 Compare October 19, 2025 16:58
@msmolens msmolens merged commit 1ce462c into main Oct 19, 2025
2 checks passed
@msmolens msmolens deleted the fix-chrome-last-visit-time branch October 19, 2025 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants