feat(bookmarks): add message bookmarks (MSC4438)#601
Draft
Just-Insane wants to merge 12 commits intoSableClient:devfrom
Draft
feat(bookmarks): add message bookmarks (MSC4438)#601Just-Insane wants to merge 12 commits intoSableClient:devfrom
Just-Insane wants to merge 12 commits intoSableClient:devfrom
Conversation
- bookmarkDomain: types, djb2 ID algorithm, helpers - bookmarkRepository: add/remove/list over account data - state/bookmarks: Jotai atoms (list, loading, id set for O(1) lookup) - useBookmarks: hooks (list, loading, isBookmarked, add/remove/refresh) - BookmarksList: full page (filter, room-grouped, jump, remove dialog) - paths/pathUtils/useHomeSelected/Router: HOME_BOOKMARKS_PATH + route - Home: Bookmarks NavItem (gated behind enableMessageBookmarks flag) - Message: MessageBookmarkItem (gated behind enableMessageBookmarks flag) - settings: enableMessageBookmarks: false (experimental, opt-in) - Experimental: MSC4438MessageBookmarks toggle with issue SableClient#600 link Closes SableClient#600
Add experiment infrastructure (ExperimentConfig, selectExperimentVariant, useExperimentVariant) to useClientConfig following PR SableClient#572 pattern. Add 'messageBookmarks' experiment entry to config.json (disabled by default). Operators can enable via config.json or CLIENT_CONFIG_OVERRIDES_JSON env var. Gate bookmarks in Home.tsx and MessageBookmarkItem with experiment flag OR user's experimental settings toggle — either path enables the feature.
dozro
reviewed
Mar 30, 2026
dozro
requested changes
Mar 30, 2026
…Event enum, remove separator comments
- Add useInitBookmarks hook: uses useSyncState (Syncing transition) + useAccountDataCallback for persistent, always-mounted account data subscription; same pattern as roomToUnread/mDirectList - Mount BookmarksFeature in ClientNonUIFeatures so the atom is always kept live - Remove now-redundant useEffect/useAccountDataCallback from BookmarksList - listBookmarks now scans mx.store.accountData for orphaned items (items whose event exists but ID is absent from index, caused by concurrent-write last-write-wins race) - Update test mock to expose store.accountData Map; add orphan recovery tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements MSC4438 message bookmarks as an experimental feature, allowing users to save individual messages to a personal bookmark list stored in Matrix account data.
Fixes #600
What's included:
bookmarkDomain.ts,bookmarkRepository.ts— bookmark ID algorithm (djb2-style, compatible with Cinny reference impl), account data CRUD helpers following MSC4438 ordering guarantees (item written before index)state/bookmarks.ts— Jotai atoms (bookmarkListAtom,bookmarkLoadingAtom,bookmarkIdSetAtom) reactive to Matrix account datauseBookmarks.ts—useBookmarkList,useIsBookmarked,useBookmarkActions(refresh, add, remove with optimistic updates)BookmarksList.tsx— sidebar page with room filter, Jump button, remove buttonMessageBookmarkIteminMessage.tsx— context menu entry to bookmark/unbookmark a messagebookmarkspath under home,useHomeBookmarksSelectedhook, wired intoRouter.tsxMSC4438MessageBookmarks.tsxin Experimental settings — per-user opt-inThe feature is gated by two independent mechanisms (either enables it): the
config.jsonexperiments.messageBookmarksflag (operator level) and the per-user experimental settings toggle.References:
Type of change
Checklist:
AI disclosure:
This PR was fully generated with GitHub Copilot. The implementation adds MSC4438 message bookmarks: a djb2-style hash function generates a stable bookmark ID from
roomId|eventId, which is used as the account data event-type suffix. The repository layer writes item events before updating the index (as required by MSC4438 for cross-device consistency) and soft-deletes items on removal since account data cannot be deleted from the server. Jotai atoms hold the cached bookmark list and a derivedSetfor O(1) per-message lookup. The UI consists of a sidebar list page (with room filter and jump/remove actions) and a context menu entry on message bubbles that toggles bookmark state with optimistic local updates.