Skip to content

Fix saved concepts not appearing on Profile (#90) - #96

Merged
Muawiya-contact merged 5 commits into
developfrom
fix/90-saved-concepts
Sep 5, 2026
Merged

Fix saved concepts not appearing on Profile (#90)#96
Muawiya-contact merged 5 commits into
developfrom
fix/90-saved-concepts

Conversation

@Muawiya-contact

Copy link
Copy Markdown
Member

Closes #90.

Root cause

The Profile "Saved concepts" list mapped progress.bookmarks (server concept
slugs) through the bundled 20-concept demo catalog (CONCEPTS_BY_ID). For
signed-in users on the 125+ server catalog, those slugs aren't in the bundle, so
every saved lesson resolved to nothing and the list stayed empty. (Same class as
the Stats bug #35.) /me/state also only returned bare slugs, so the app had no
title/topic to render anyway.

Fix

Backend/v1/me/state now returns a saved array of {concept_slug, title, topic_name} (like learned already does), additive: the existing
bookmarks slug list is unchanged, so already-installed apps keep working and
the backend can deploy independently.

Mobile

  • ProgressState.savedConcepts carries the server details; the Profile renders
    the saved list from it, falling back to the bundled catalog only for the
    signed-out demo.
  • After a save/unsave the repo reloads /me/state (the toggle endpoint returns
    no body) so the list reflects the change; the optimistic bookmark flip still
    updates the card + count instantly.
  • CategoryChip now accepts any label string (topic names match the Category
    values).

Verification

  • Backend: 88 tests pass, incl. a new test asserting a saved concept comes
    back with title + topic.
  • npx tsc --noEmit clean.

Note

Backend and mobile ship together for the full fix, but they're decoupled: the
backend change is safe to deploy before the app update (old apps ignore the new
field), and the app update degrades gracefully if it sees no saved field.

The saved list only had bare slugs, so the app could not name a saved concept
without the bundled demo catalog. Add a 'saved' field carrying {slug,title,topic}
alongside the existing 'bookmarks' slugs (kept for membership/count and for
already-installed apps that don't read the new field).
)

Parse the server's new 'saved' details into ProgressState.savedConcepts, and
reload full state after a save/unsave (the toggle endpoint returns no body) so
the saved list reflects the change. bookmarks slugs stay for the instant
optimistic card + count.
Signed-in bookmarks were resolved against the bundled 20-concept catalog, so
server-catalog saves never showed. Render from savedConcepts when present, fall
back to the bundled catalog for the signed-out demo. Broaden CategoryChip to
accept any label string (topic names match the Category values).
toggleBookmark reloads /me/state to refresh the saved list, but a failed reload
threw after the save had already persisted, so ProgressContext rolled the UI
back to un-saved. Catch the reload failure and patch in place instead, so a
succeeded toggle is never reverted; the saved list catches up on the next load.

@Muawiya-contact Muawiya-contact left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good Change.

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.

Saved concepts don't appear under SAVED CONCEPTS on Profile

1 participant