Skip to content

fix: fetch bookmark IDs on boot so icons reflect saved state on any page#134

Merged
sandragjacinto merged 2 commits into
mainfrom
fix/bookmark-ids-on-boot
Jun 18, 2026
Merged

fix: fetch bookmark IDs on boot so icons reflect saved state on any page#134
sandragjacinto merged 2 commits into
mainfrom
fix/bookmark-ids-on-boot

Conversation

@noor-lpi

Copy link
Copy Markdown
Contributor

Summary

  • Adds fetchBookmarkIds() to the bookmarks store — calls GET /user/bookmarks, extracts IDs only (no document payloads), and sets idsBookmarked
  • Calls it from App.vue's boot sequence in parallel with existing init calls, so it costs no extra time

Why

idsBookmarked was always empty on page load until the user visited the bookmarks tab. This caused already-saved documents to appear un-bookmarked on the search/chat pages, and clicking the bookmark icon would try to add a duplicate instead of removing.

Test plan

  • Bookmark some documents, then hard-refresh while on the search page — saved docs should show filled bookmark icons immediately
  • Clicking a filled icon should remove the bookmark (not re-add it)
  • Visiting the bookmarks tab still loads full document data as before

🤖 Generated with Claude Code

…ny page

Without this, idsBookmarked was always empty until the user visited the
bookmarks tab, causing saved docs to appear un-bookmarked on search/chat
and toggleBookmark to add instead of remove.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@noor-lpi noor-lpi requested a review from sandragjacinto June 16, 2026 13:23
@noor-lpi noor-lpi self-assigned this Jun 16, 2026
Comment thread src/stores/bookmarks.ts Outdated
Comment on lines +39 to +49
const fetchBookmarkIds = async () => {
try {
const result = await baseGetAxios('/user/bookmarks');
idsBookmarked.value = (result.bookmarks ?? []).map(
(b: { document_id: string }) => b.document_id
);
} catch (error) {
console.error('Failed to fetch bookmark IDs:', error);
}
};

@sandragjacinto sandragjacinto Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I just realized that this method is not needed , since it does the same as getBoomarks that is on mine 50.
To avoid having duplicated code, the getBookmarks one should be used.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good catch. see newest commit. thanks.

fetchBookmarkIds was a subset of getBookmarks — both set idsBookmarked,
getBookmarks also loads full document payloads. Using getBookmarks directly
removes the duplicate and pre-loads bookmark data so the bookmarks tab
renders instantly on first visit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sandragjacinto sandragjacinto merged commit 8896f94 into main Jun 18, 2026
3 checks passed
@sandragjacinto sandragjacinto deleted the fix/bookmark-ids-on-boot branch June 18, 2026 08:25
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