Skip to content

fix(favorites): key card favourites by resource URL, not id - #103

Closed
Coder-soft wants to merge 1 commit into
creatorcluster:mainfrom
Coder-soft:fix/favorites-url-key
Closed

Coder-soft wants to merge 1 commit into
creatorcluster:mainfrom
Coder-soft:fix/favorites-url-key

Conversation

@Coder-soft

@Coder-soft Coder-soft commented Oct 9, 2026 •

Copy link
Copy Markdown

Fixes a pre-existing bug (present on main, not introduced by the redesign): saving a resource to favourites from a card never showed up in the Favorites tab.

Root cause

ResourceCard keyed favourites by String(resource.id) ("399", "mcicons-4001"), but every other consumer keys by getResourceUrl(resource) — the Favorites tab filter, FavoritesSidebar, the folder logic, and the user_favorites.resource_url DB column. The two keys never match (ids are numeric / mcicons-*; URLs are raw.githubusercontent.com/...), so the tab was always empty.

Verified against the real data: all resources expose a URL, and no id equals its URL.

Fix

ResourceCard now uses getResourceUrl(resource) for isFavorited and toggleFavorite, matching the rest of the app.

Verified

Signed-out flow in the browser: heart a card → localStorage.rd_guest_favorites stores the resource URL → Favorites tab renders the card (previously empty).

Note

Favourites previously stored under the id key are orphaned, but they never rendered anywhere, so no user-visible data is lost.

Summary by CodeRabbit

  • Bug Fixes
    • Resource favorites now use the resource URL to check and update favorite status.

Saving a favourite from a resource card never appeared in the Favorites tab
for signed-out users (and signed-in users alike).

Root cause: ResourceCard keyed favourites by `String(resource.id)`
(e.g. "399"), while the Favorites tab, FavoritesSidebar, folder logic and the
`user_favorites.resource_url` DB column all key by `getResourceUrl(resource)`
(the download URL). The stored key never matched the lookup, so the tab was
always empty.

Fix: use `getResourceUrl(resource)` in ResourceCard's isFavorited/toggle paths,
matching every other consumer.

Note: previously-stored favourites were keyed by id and are unreadable, but
they never rendered anywhere, so nothing user-visible is lost.
@vercel

vercel Bot commented Oct 9, 2026

Copy link
Copy Markdown

@Coder-soft is attempting to deploy a commit to the yamura3's projects Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e807af5c-1199-4f29-adaf-6bf683e55e9c

📥 Commits

Reviewing files that changed from the base of the PR and between fd6ba64 and 092f8a5.


📒 Files selected for processing (1)
  • src/components/resources/ResourceCard.tsx

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Walkthrough

Walkthrough

ResourceCard now uses each resource’s URL, rather than its stringified ID, to check and toggle its favorite state.

Changes

Resource favorites

Layer / File(s) Summary
Use resource URLs for favorite keys
src/components/resources/ResourceCard.tsx
ResourceCard imports getResourceUrl and uses the resource URL for favorite status lookup and toggling.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix


Merge Risk: ⚪ Minimal · up to 092f8

The URL-less case does not create a malformed favorite, and no other actionable merge risk is established.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: favorites now use the resource URL instead of the resource ID as the key.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit hops by the resource card
It checks the URL with a twitch of its nose
A favorite flips with a gentle tap
No ID string slips into the burrow
The rabbit nods, then bounds away
With links tucked neatly in its paws

Comment @coderabbitai help to get the list of available commands.

Coder-soft added a commit to Coder-soft/renderdragon.org that referenced this pull request Oct 9, 2026
Same fix as the standalone creatorcluster#103, applied to the redesigned card so the
redesign branch does not carry the pre-existing id/URL mismatch.
@Coder-soft

Copy link
Copy Markdown
Author

Closing for now — the redesign is being set aside to land as smaller, separate updates. Will revisit later.

@Coder-soft Coder-soft closed this Oct 12, 2026
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.

1 participant